In the ->multi_resize() method of the WP_Image_Editor subclasses, when looping through potential crops, we need to make sure the crop isn't the exact same dimensions as the original image before copying it as a new crop.
This ensures that we don't save multiple copies of the same image. Supposedly broke in [30639], but this logic was always missing. When I tested reverting [30639], there were still 2 files being created. Fixes #31296. Built from https://develop.svn.wordpress.org/trunk@31576 git-svn-id: http://core.svn.wordpress.org/trunk@31557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -231,8 +231,9 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
|
||||
}
|
||||
|
||||
$image = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
|
||||
$duplicate = ( ( $orig_size['width'] == $size_data['width'] ) && ( $orig_size['height'] == $size_data['height'] ) );
|
||||
|
||||
if( ! is_wp_error( $image ) ) {
|
||||
if ( ! is_wp_error( $image ) && ! $duplicate ) {
|
||||
$resized = $this->_save( $image );
|
||||
|
||||
imagedestroy( $image );
|
||||
|
||||
Reference in New Issue
Block a user