Make WordPress Core

Changeset 22571


Ignore:
Timestamp:
11/14/2012 02:26:52 PM (12 years ago)
Author:
nacin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/image.php

    r22553 r22571  
    100100        $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
    101101
    102         $editor = WP_Image_Editor::get_instance( $file );
    103 
    104         if ( ! is_wp_error( $editor ) )
    105             $metadata['sizes'] = $editor->multi_resize( $sizes );
     102        if ( $sizes ) {
     103            $editor = WP_Image_Editor::get_instance( $file );
     104
     105            if ( ! is_wp_error( $editor ) )
     106                $metadata['sizes'] = $editor->multi_resize( $sizes );
     107        } else {
     108            $metadata['sizes'] = array();
     109        }
    106110
    107111        // fetch additional metadata from exif/iptc
Note: See TracChangeset for help on using the changeset viewer.