Ticket #12218: only_croped_images_for_thumbnails.diff
| File only_croped_images_for_thumbnails.diff, 1.3 KB (added by , 17 years ago) |
|---|
-
wp-includes/media.php
434 434 'file' => basename( $resized_file ), 435 435 'width' => $info[0], 436 436 'height' => $info[1], 437 'crop' => $crop 437 438 ); 438 439 } 439 440 } … … 460 461 * @param array|string $size Optional, default is 'thumbnail'. Size of image, either array or string. 461 462 * @return bool|array False on failure or array of file path, width, and height on success. 462 463 */ 463 function image_get_intermediate_size($post_id, $size ='thumbnail') {464 function image_get_intermediate_size($post_id, $size = 'thumbnail' ) { 464 465 if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) ) 465 466 return false; 466 467 468 $croped_ok = ( in_array($size, array('thumbnail', 'post-thumbnail')) && get_option('thumbnail_crop') ); 469 467 470 // get the best one for a specified set of dimensions 468 471 if ( is_array($size) && !empty($imagedata['sizes']) ) { 469 472 foreach ( $imagedata['sizes'] as $_size => $data ) { 473 if ( !$croped_ok && !empty($data['crop']) ) 474 continue; 470 475 // already cropped to width or height; so use this size 471 476 if ( ( $data['width'] == $size[0] && $data['height'] <= $size[1] ) || ( $data['height'] == $size[1] && $data['width'] <= $size[0] ) ) { 472 477 $file = $data['file'];
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)