mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
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:
parent
16d474437f
commit
35eec2dd57
@ -19,7 +19,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
|||||||
protected $image = null; // Imagick Object
|
protected $image = null; // Imagick Object
|
||||||
|
|
||||||
function __destruct() {
|
function __destruct() {
|
||||||
if ( $this->image ) {
|
if ( $this->image instanceof Imagick ) {
|
||||||
// we don't need the original in memory anymore
|
// we don't need the original in memory anymore
|
||||||
$this->image->clear();
|
$this->image->clear();
|
||||||
$this->image->destroy();
|
$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.
|
* @return boolean|WP_Error True if loaded; WP_Error on failure.
|
||||||
*/
|
*/
|
||||||
public function load() {
|
public function load() {
|
||||||
if ( $this->image )
|
if ( $this->image instanceof Imagick )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
|
if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
|
||||||
@ -124,6 +124,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->image = new Imagick( $this->file );
|
$this->image = new Imagick( $this->file );
|
||||||
|
ob_start(); var_dump( $this->image instanceof Imagick ); error_log( ob_get_clean() );
|
||||||
|
|
||||||
if( ! $this->image->valid() )
|
if( ! $this->image->valid() )
|
||||||
return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);
|
return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);
|
||||||
|
Loading…
Reference in New Issue
Block a user