| 1 | Index: wp-includes/media.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/media.php (revision 13105) |
|---|
| 4 | +++ wp-includes/media.php (working copy) |
|---|
| 5 | @@ -434,6 +434,7 @@ |
|---|
| 6 | 'file' => basename( $resized_file ), |
|---|
| 7 | 'width' => $info[0], |
|---|
| 8 | 'height' => $info[1], |
|---|
| 9 | + 'crop' => $crop |
|---|
| 10 | ); |
|---|
| 11 | } |
|---|
| 12 | } |
|---|
| 13 | @@ -460,13 +461,17 @@ |
|---|
| 14 | * @param array|string $size Optional, default is 'thumbnail'. Size of image, either array or string. |
|---|
| 15 | * @return bool|array False on failure or array of file path, width, and height on success. |
|---|
| 16 | */ |
|---|
| 17 | -function image_get_intermediate_size($post_id, $size='thumbnail') { |
|---|
| 18 | +function image_get_intermediate_size($post_id, $size = 'thumbnail' ) { |
|---|
| 19 | if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) ) |
|---|
| 20 | return false; |
|---|
| 21 | |
|---|
| 22 | + $croped_ok = ( in_array($size, array('thumbnail', 'post-thumbnail')) && get_option('thumbnail_crop') ); |
|---|
| 23 | + |
|---|
| 24 | // get the best one for a specified set of dimensions |
|---|
| 25 | if ( is_array($size) && !empty($imagedata['sizes']) ) { |
|---|
| 26 | foreach ( $imagedata['sizes'] as $_size => $data ) { |
|---|
| 27 | + if ( !$croped_ok && !empty($data['crop']) ) |
|---|
| 28 | + continue; |
|---|
| 29 | // already cropped to width or height; so use this size |
|---|
| 30 | if ( ( $data['width'] == $size[0] && $data['height'] <= $size[1] ) || ( $data['height'] == $size[1] && $data['width'] <= $size[0] ) ) { |
|---|
| 31 | $file = $data['file']; |
|---|