Download - Dealing with media

Transcript
Page 1: Dealing with media

Dealing with media

Page 2: Dealing with media

Me

• WordPress core contributor

• GlotPress core developer

• Recent rockstar of 3.4

• Co author of WP_Image_Editor

• Working a lot with media

• Hacking plugins together

Page 3: Dealing with media

Sometimes you need to make a changeWordPress 3.5 did that for media

Page 4: Dealing with media

WordPress 3.5

• New media manager

• Ability for multiple galleries

• Insert multiple images

• Rewrite of backend API

• Support for ImageMagick

Page 5: Dealing with media

Old media manager

Page 6: Dealing with media

New media manager

Page 7: Dealing with media

Drag and drop

Page 8: Dealing with media

Galleries

Page 9: Dealing with media

Edit the gallery

Page 10: Dealing with media

Demo - gallery

Page 11: Dealing with media

A lot of changes at once

Page 12: Dealing with media
Page 13: Dealing with media

Complains

• Opening media dialog shows library instead of upload screen

• Adding a featured image is more convoluted

• Inputting meta data has become more difficult

• Gallery sorting for the shortcode dissappeared

• General response of not working due to plugins breaking stuff

Page 14: Dealing with media

How can we make it better?

Page 15: Dealing with media

Work together with the WordPress UI team

Page 16: Dealing with media

Extend it with plugins

• Media tags (taxonomies)

• Faster image insert

• Multimedia box

• Media folders (dev)

Page 17: Dealing with media

Faster image insert

Page 18: Dealing with media

Multimedia box

Page 19: Dealing with media

Media folders

Page 20: Dealing with media

Features

• Ability to put media into folders

• Show folders on media page

• Drag & Drop support

Page 21: Dealing with media

Still missing

• Better way to change the folder name

• Media dialog tab

• Gallery folder support

• Upload straight into a folder

Page 22: Dealing with media

Demo - Media folders

Page 23: Dealing with media

How to

Page 24: Dealing with media

// Create the media frame. image_frame = wp.media.frames.formatImage = wp.media({ // Set the title of the modal. title: $el.data('choose'),

// Tell the modal to show only images. library: { type: 'image' },

// Customize the submit button. button: { // Set the text of the button. text: $el.data('update') } });

image_frame.open();

Page 25: Dealing with media

// If the media frame already exists, reopen it. if ( image_frame ) { image_frame.open(); }

Page 26: Dealing with media

Magic function when loading all WordPress related code

wp_enqueue_media()

Page 27: Dealing with media

So we talked aboutmedia in general

Page 28: Dealing with media

Dealing with images

Page 29: Dealing with media

Dealing with images

• Having multiple image sizes

• Making changes

• But you can have issues like:

• Weird color differences

• Missing information in sizes

Page 30: Dealing with media

Using add_image_size ()

Page 31: Dealing with media

$awesome = new WP_Image_Editor

Page 32: Dealing with media

$image = wp_get_image_editor( 'cool_image.jpg' );

if ( ! is_wp_error( $image ) ) { $image->rotate( 90 ); $image->resize( 300, 300, true ); $image->save( 'new_image.jpg' );}

Page 33: Dealing with media

Midden crop$editor->resize( 300, 300, true );

Links boven$editor->crop( 0, 0, 300, 300, 300, 300, false );

Midden crop metrotatie en flip

$editor->flip( false, true );

$editor->rotate( 30 );

$editor->crop( (1589-(960*0.7))/2, (1472-(1280*0.7))/2, 960*0.7, 1280*0.7, 300, 300, false );

More examples

Page 34: Dealing with media

Using this code in your own pluginLook at what WPThumb has done

Page 35: Dealing with media

WP_Thumb

• https://github.com/humanmade/WPThumb

• On demand image resizing for WordPress

• Automatic images resizing, cropping and caching.

• Ideal for when you want to change the dimensions of default image sizes.

Page 36: Dealing with media

WP_Image

• https://github.com/markoheijnen/WP_Image

• WP_Image_Editor layer for attachments

• add_image_size()

• store_image()

• get_editor()

• get_meta_data()

Page 37: Dealing with media

As mentioned not just a big refactoring of the codebase

Page 38: Dealing with media

ImageMagick & GraphicMagick support

The improvement photographers will like

Page 39: Dealing with media

The difference

Page 41: Dealing with media

Image editorThe one thing that didn’t got changed in 3.5

Page 42: Dealing with media

A better image editor

• A popup to change an image

• No more opening a new venster from the new image dialog

• Better ways to say on which image size it should apply

• The image editor should be extendable

• Be able to use image filters for example. No Instagram anymore but just WordPress for all your images

Page 43: Dealing with media

Demo - My editor playground

Page 44: Dealing with media

Dealing with video/audio

Page 45: Dealing with media

Dealing with Video/Audio

• Core support in 3.6

• MediaElement.js

• [video width="600" height="480" mp4="source.mp4" ogv="source.ogv" webm="source.webm"]

• http://my.mp3s.com/cool/songs/coolest.mp3


Top Related