Confirm we are dealing with an Imagick object. see #24539.

git-svn-id: http://core.svn.wordpress.org/trunk@24765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-07-22 17:01:00 +00:00
parent 16d474437f
commit 35eec2dd57
1 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
protected $image = null; // Imagick Object
function __destruct() {
if ( $this->image ) {
if ( $this->image instanceof Imagick ) {
// we don't need the original in memory anymore
$this->image->clear();
$this->image->destroy();
@ -113,7 +113,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* @return boolean|WP_Error True if loaded; WP_Error on failure.
*/
public function load() {
if ( $this->image )
if ( $this->image instanceof Imagick )
return true;
if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
@ -124,6 +124,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
try {
$this->image = new Imagick( $this->file );
ob_start(); var_dump( $this->image instanceof Imagick ); error_log( ob_get_clean() );
if( ! $this->image->valid() )
return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);