Make WordPress Core

Ticket #23779: 23779.2.diff

File 23779.2.diff, 1.4 KB (added by kovshenin, 11 years ago)
  • wp-includes/media.php

     
    17051705                                        'url'         => $downsize[0],
    17061706                                        'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape',
    17071707                                );
    1708                         } elseif ( isset( $meta['sizes'][ $size ] ) ) {
     1708                        } else {
    17091709                                if ( ! isset( $base_url ) )
    17101710                                        $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
    17111711
    1712                                 // Nothing from the filter, so consult image metadata if we have it.
    1713                                 $size_meta = $meta['sizes'][ $size ];
     1712                                // If image metadata for this size exists, use it, otherwise use original.
     1713                                $size_meta = ( isset( $meta['sizes'][ $size ] ) ) ? $meta['sizes'][ $size ] : $meta;
    17141714
    17151715                                // We have the actual image size, but might need to further constrain it if content_width is narrower.
    17161716                                // Thumbnail, medium, and full sizes are also checked against the site's height/width options.
    17171717                                list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' );
    17181718
     1719                                // If dimensions have not changed from the original, skip this image size.
     1720                                if ( $width == $meta['width'] && $height == $meta['height'] )
     1721                                        continue;
     1722
    17191723                                $sizes[ $size ] = array(
    17201724                                        'height'      => $height,
    17211725                                        'width'       => $width,