WordPress 3.5 is introducing the “WP_Image_Editor” class which developers will be able to use to manipulate images. The image editor will add support for Imagick by default which should help with better quality images.
Several existing image manipulation filters have been deprecated as per this new change in WordPress core. These filters will no longer function:
- image_save_pre filter is now image_editor_save_pre
- wp_save_image_file filter is now wp_save_image_editor_file
- image_edit_before_change filter is now wp_image_editor_before_change
How to use the WP_Image_Editor Class?
Here is a quick example that should show you how to use it:
$image = wp_get_image_editor( 'source_image.jpg' ); if (!is_wp_error($image)) { $image->rotate( 90 ); $image->resize( 300, 300, true ); $image->save( 'new_image_file.jpg' ); }
Additional Resources
The following classes should give you more ideas on how to fully take advantage of this built in image editor: