WordPress.org

Make WordPress Core

Ticket #11801: wp-image_get_intermediate_size-patch.diff

File wp-image_get_intermediate_size-patch.diff, 717 bytes (added by mkaganer, 8 years ago)
  • wp-includes/media.php

     
    484484                        ksort($areas);
    485485                        foreach ( $areas as $_size ) {
    486486                                $data = $imagedata['sizes'][$_size];
    487                                 if ( $data['width'] >= $size[0] || $data['height'] >= $size[1] ) {
     487                                // find a size where *both* width and height are bigger or equal to the required
     488                                if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) {
    488489                                        $file = $data['file'];
    489490                                        list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size );
    490491                                        return compact( 'file', 'width', 'height' );