wp_generate_attachment_metadata() should not call WP_Image_Editor if there's nothing to resize. props mdawaffe. fixes #22438.

git-svn-id: http://core.svn.wordpress.org/trunk@22571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-14 14:26:52 +00:00
parent 39528d3c11
commit f68b6006de
1 changed files with 7 additions and 3 deletions

View File

@ -99,10 +99,14 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes ); $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
if ( $sizes ) {
$editor = WP_Image_Editor::get_instance( $file ); $editor = WP_Image_Editor::get_instance( $file );
if ( ! is_wp_error( $editor ) ) if ( ! is_wp_error( $editor ) )
$metadata['sizes'] = $editor->multi_resize( $sizes ); $metadata['sizes'] = $editor->multi_resize( $sizes );
} else {
$metadata['sizes'] = array();
}
// fetch additional metadata from exif/iptc // fetch additional metadata from exif/iptc
$image_meta = wp_read_image_metadata( $file ); $image_meta = wp_read_image_metadata( $file );