Ticket #22738: 22738.diff
File 22738.diff, 1.6 KB (added by , 11 years ago) |
---|
-
wp-includes/media.php
252 252 * @return array First item is the width, the second item is the height. 253 253 */ 254 254 function wp_constrain_dimensions( $current_width, $current_height, $max_width=0, $max_height=0 ) { 255 if ( !$max_width and !$max_height)255 if ( ( !$max_width and !$max_height ) || ( $max_width == $current_width && $max_height == $current_height ) ) 256 256 return array( $current_width, $current_height ); 257 257 258 258 $width_ratio = $height_ratio = 1.0; … … 1369 1369 1370 1370 // Nothing from the filter, so consult image metadata if we have it. 1371 1371 $size_meta = $meta['sizes'][ $size ]; 1372 1373 // We have the actual image size, but might need to further constrain it if content_width is narrower 1374 // This is not necessary for thumbnails and medium size 1375 if ( 'thumbnail' == $size || 'medium' == $size ) { 1376 $width = $size_meta['width']; 1377 $height = $size_meta['height']; 1378 } 1379 else 1380 list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size ); 1381 1372 1382 $sizes[ $size ] = array( 1373 'height' => $ size_meta['height'],1374 'width' => $ size_meta['width'],1383 'height' => $height, 1384 'width' => $width, 1375 1385 'url' => $base_url . $size_meta['file'], 1376 'orientation' => $ size_meta['height'] > $size_meta['width']? 'portrait' : 'landscape',1386 'orientation' => $height > $width ? 'portrait' : 'landscape', 1377 1387 ); 1378 1388 } 1379 1389 }