Only unset() after we have confirmed we are not dealing with a WP_Error. props DH-Shredder. fixes #22824.
git-svn-id: http://core.svn.wordpress.org/trunk@23133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0eb2c5bf46
commit
aac3ea45f3
|
@ -190,10 +190,11 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
|
||||||
$resized = $this->_save( $image );
|
$resized = $this->_save( $image );
|
||||||
|
|
||||||
imagedestroy( $image );
|
imagedestroy( $image );
|
||||||
unset( $resized['path'] );
|
|
||||||
|
|
||||||
if ( ! is_wp_error( $resized ) && $resized )
|
if ( ! is_wp_error( $resized ) && $resized ) {
|
||||||
|
unset( $resized['path'] );
|
||||||
$metadata[$size] = $resized;
|
$metadata[$size] = $resized;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->size = $orig_size;
|
$this->size = $orig_size;
|
||||||
|
|
|
@ -268,10 +268,11 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||||
$this->image->clear();
|
$this->image->clear();
|
||||||
$this->image->destroy();
|
$this->image->destroy();
|
||||||
$this->image = null;
|
$this->image = null;
|
||||||
unset( $resized['path'] );
|
|
||||||
|
|
||||||
if ( ! is_wp_error( $resized ) && $resized )
|
if ( ! is_wp_error( $resized ) && $resized ) {
|
||||||
|
unset( $resized['path'] );
|
||||||
$metadata[$size] = $resized;
|
$metadata[$size] = $resized;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->size = $orig_size;
|
$this->size = $orig_size;
|
||||||
|
|
Loading…
Reference in New Issue