mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Media: Bail early if image is already the requested size.
In `WP_Image_Editor_Imagick`, bail early in `make_subsize()` if the image is already the requested size. Previously, `make_subsize()` would create another copy of the file. `WP_Image_Editor_GD` doesn't have the same problem. Props wojtekn, danielbachhuber. Fixes #57370. git-svn-id: https://develop.svn.wordpress.org/trunk@55278 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -503,6 +503,10 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||
$size_data['crop'] = false;
|
||||
}
|
||||
|
||||
if ( ( $this->size['width'] == $size_data['width'] ) && ( $this->size['height'] == $size_data['height'] ) ) {
|
||||
return new WP_Error( 'image_subsize_create_error', __( 'The image already has the requested size.' ) );
|
||||
}
|
||||
|
||||
$resized = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
|
||||
|
||||
if ( is_wp_error( $resized ) ) {
|
||||
|
||||
Reference in New Issue
Block a user