WP_Image_Editor: the last stand.

* Have wp_get_image_editor() rather than WP_Image_Editor::get_instance(). Having static factory methods would be less confusing if there weren't also static methods tied to individual editor implementations.
 * Lazy-load the WP_Image_Editor base class and editor implementations.
 * Have WP_Image_Editor_GD::supports_mime_type() actually check which types it supports.
 * Deprecate gd_edit_image_support() in favor of wp_image_editor_supports().

props DH-Shredder, scribu, markoheijnen. fixes #22356. see #6821.



git-svn-id: http://core.svn.wordpress.org/trunk@22817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin
2012-11-22 09:52:16 +00:00
parent 1e472d8974
commit 9120cf3375
9 changed files with 216 additions and 170 deletions

View File

@@ -36,7 +36,7 @@ function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $s
}
}
$editor = WP_Image_Editor::get_instance( $src );
$editor = wp_get_image_editor( $src );
if ( is_wp_error( $editor ) )
return $editor;
@@ -100,7 +100,7 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
if ( $sizes ) {
$editor = WP_Image_Editor::get_instance( $file );
$editor = wp_get_image_editor( $file );
if ( ! is_wp_error( $editor ) )
$metadata['sizes'] = $editor->multi_resize( $sizes );