The awesome things you can do with images inside WordPress

30
The awesome things you can do with images WordCamp Norway January 26, 2012 Marko Heijnen

description

At this presentation at WordCamp Norway I discussed the new media flow in WordPress 3.5 and how you can use it to do really awesome stuff.

Transcript of The awesome things you can do with images inside WordPress

Page 1: The awesome things you can do with images inside WordPress

The awesome things you can do with images

WordCamp NorwayJanuary 26, 2012Marko Heijnen

Page 2: The awesome things you can do with images inside WordPress

Who am I?

• Marko Heijnen

• WordPress and mobile developer

• WordPress contributor of 3.0, 3.3, 3.4 and 3.5

• Recent rockstar of 3.4

• Co author of the new image manipulation code - WP_Image_Editor

• Love to hack around in WordPress

Page 3: The awesome things you can do with images inside WordPress

So let’s talk about 3.5(.1) for a bit

Page 4: The awesome things you can do with images inside WordPress

Features

• Media library redesign

• TwentyTwelve

• Links are removed

• New welcome screen

• New color picker

• Favorite plugins

• oEmbed support for SoundCloud, Slideshare en Instagram

• HiDPI Dashboard

• Taxonomy metaboxes are smaller with a few items

• Admin column for taxonomies

• Orderen on IDs in 'post__in'

• Default PHP limit of 40 MB

• WP_Post class

• XML-RPC default on

• WP_Image_Editor class

• Multi site improvements like switch_to_blog()

Page 5: The awesome things you can do with images inside WordPress

Features

• Media library redesign

• TwentyTwelve

• Links are removed

• New welcome screen

• New color picker

• Favorite plugins

• oEmbed support for SoundCloud, Slideshare en Instagram

• HiDPI Dashboard

• Taxonomy metaboxes are smaller with a few items

• Admin column for taxonomies

• Orderen on IDs in 'post__in'

• Default PHP limit of 40 MB

• WP_Post class

• XML-RPC default on

• WP_Image_Editor class

• Multi site improvements like switch_to_blog()

Page 6: The awesome things you can do with images inside WordPress

Media library redesign

Complete rewrite in 3.5

Page 7: The awesome things you can do with images inside WordPress

Media bibliotheek redesign

Page 8: The awesome things you can do with images inside WordPress

We all know the ugly box before 3.5

Page 9: The awesome things you can do with images inside WordPress

New media dialog

Page 10: The awesome things you can do with images inside WordPress

A huge drag en drop area

Page 11: The awesome things you can do with images inside WordPress

A 1000 times better way to create a gallery

Page 12: The awesome things you can do with images inside WordPress

Changing a gallery is just easy now

Page 13: The awesome things you can do with images inside WordPress

And you see a simple representation of the gallery now

Page 14: The awesome things you can do with images inside WordPress

Gallery on the front-end

Page 15: The awesome things you can do with images inside WordPress

Little demo

https://gist.github.com/4635255

Page 16: The awesome things you can do with images inside WordPress

That was fun but there issomething we are missing

Page 17: The awesome things you can do with images inside WordPress

WP_Image_Editor

The backend API that we now have for manipulating images

Page 18: The awesome things you can do with images inside WordPress

WP_Image_Editor

• No more GD

• You can now use Imagick (core) or Gmagick (plugin)

• Possible to change the quality of PNG’s too

• Possible to change the mime type if needed

Page 19: The awesome things you can do with images inside WordPress

But what is Imagick?

Page 20: The awesome things you can do with images inside WordPress

GD

Page 21: The awesome things you can do with images inside WordPress

Imagick

Page 22: The awesome things you can do with images inside WordPress

So happy clients who are usinghigh quality pictures

Page 23: The awesome things you can do with images inside WordPress

$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' );}

Code example

Page 24: The awesome things you can do with images inside WordPress

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 );

WP_Image_Editor examples

Page 25: The awesome things you can do with images inside WordPress

WPThumb

https://github.com/humanmade/WPThumb

• Used a lot for caching custom image sizes

• Previous it was using PHPThumb but now it’s using WP_Image_Editor

Page 26: The awesome things you can do with images inside WordPress

What’s next for core

Page 27: The awesome things you can do with images inside WordPress

WP_Image

• A way to retrieve a WP_Image_Editor by attachment ID

• Creating custom images and saved them in the image meta data

• Hopefully it helps out one day to not create images on the fly

Page 28: The awesome things you can do with images inside WordPress

A better image editor

• A popup to change an image

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

• The image editor should be extendable

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

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

Page 29: The awesome things you can do with images inside WordPress

And yes I got something to show you