mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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:
parent
39528d3c11
commit
f68b6006de
@ -99,10 +99,14 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
||||
|
||||
$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
|
||||
|
||||
$editor = WP_Image_Editor::get_instance( $file );
|
||||
if ( $sizes ) {
|
||||
$editor = WP_Image_Editor::get_instance( $file );
|
||||
|
||||
if ( ! is_wp_error( $editor ) )
|
||||
$metadata['sizes'] = $editor->multi_resize( $sizes );
|
||||
if ( ! is_wp_error( $editor ) )
|
||||
$metadata['sizes'] = $editor->multi_resize( $sizes );
|
||||
} else {
|
||||
$metadata['sizes'] = array();
|
||||
}
|
||||
|
||||
// fetch additional metadata from exif/iptc
|
||||
$image_meta = wp_read_image_metadata( $file );
|
||||
|
Loading…
Reference in New Issue
Block a user