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:
parent
f6b1b01ecd
commit
dbc38ea246
|
@ -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 );
|
||||
|
|
|
@ -301,8 +301,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
|||
}
|
||||
|
||||
$resize_result = $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( $resize_result ) ) {
|
||||
if ( ! is_wp_error( $resize_result ) && ! $duplicate ) {
|
||||
$resized = $this->_save( $this->image );
|
||||
|
||||
$this->image->clear();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-alpha-31575';
|
||||
$wp_version = '4.2-alpha-31576';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue