Fix edge-case in media cropping where selection and destination are the same size.

Adds unit tests.

Props mboynes.
Fixes #19793.

Built from https://develop.svn.wordpress.org/trunk@30639


git-svn-id: http://core.svn.wordpress.org/trunk@30629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-11-30 06:27:23 +00:00
parent 67e5d4041c
commit 5352f51516
2 changed files with 3 additions and 2 deletions

View File

@ -503,8 +503,9 @@ function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = fal
}
// if the resulting image would be the same size or larger we don't want to resize it
if ( $new_w >= $orig_w && $new_h >= $orig_h )
if ( $new_w >= $orig_w && $new_h >= $orig_h && $dest_w != $orig_w && $dest_h != $orig_h ) {
return false;
}
// the return array matches the parameters to imagecopyresampled()
// int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.1-beta2-30638';
$wp_version = '4.1-beta2-30639';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.