Ticket #34384: 34384.diff
File 34384.diff, 2.2 KB (added by , 8 years ago) |
---|
-
src/wp-includes/media.php
612 612 * 613 613 * @since 2.5.0 614 614 * 615 * @param int $post_id Attachment ID. 616 * @param array|string $size Optional. Image size. Accepts any valid image size, or an array 617 * of width and height values in pixels (in that order). 618 * Default 'thumbnail'. 615 * @param int $post_id Attachment ID. 616 * @param array|string $size Optional. Image size. Accepts any valid image size, or an array 617 * of width and height values in pixels (in that order). 618 * Default 'thumbnail'. 619 * @param bool $force_thumb Optional. Whether to force the thumbnail image to be used if is 620 * larger than the requested size. Default true. 619 621 * @return false|array $data { 620 622 * Array of file relative path, width, and height on success. Additionally includes absolute 621 623 * path and URL if registered size is passed to $size parameter. False on failure. … … 629 631 * parameter. 630 632 * } 631 633 */ 632 function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) {634 function image_get_intermediate_size( $post_id, $size = 'thumbnail', $force_thumb = true ) { 633 635 if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) ) 634 636 return false; 635 637 … … 661 663 // First, we calculate what size the original image would be if constrained to a box the size of the current image in the loop 662 664 $maybe_cropped = image_resize_dimensions($imagedata['width'], $imagedata['height'], $data['width'], $data['height'], false ); 663 665 // If the size doesn't match within one pixel, then it is of a different aspect ratio, so we skip it, unless it's the thumbnail size 664 if ( 'thumbnail' != $_size&&666 if ( ( 'thumbnail' != $_size || ! $force_thumb ) && 665 667 ( ! $maybe_cropped 666 668 || ( $maybe_cropped[4] != $data['width'] && $maybe_cropped[4] + 1 != $data['width'] ) 667 669 || ( $maybe_cropped[5] != $data['height'] && $maybe_cropped[5] + 1 != $data['height'] )