From 8e39edfdf64e5e4426072436d07b4c820ca2d0bb Mon Sep 17 00:00:00 2001 From: Mike Schroder Date: Mon, 27 Feb 2017 04:21:41 +0000 Subject: [PATCH] Media: After [40123], Feature check `setImageOrientation`. In [40123], `WP_Image_Editor_Imagick` started using `Imagick::setImageOrientation` and `Imagick::ORIENTATION_TOPLEFT`, but had no equivalent feature check. While they were introduced more than 9 years ago, it's important to double-check everything is available before using with Imagick. Fixes #37140. git-svn-id: https://develop.svn.wordpress.org/trunk@40129 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-image-editor-imagick.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-image-editor-imagick.php b/src/wp-includes/class-wp-image-editor-imagick.php index 34dd539375..3589cc22a1 100644 --- a/src/wp-includes/class-wp-image-editor-imagick.php +++ b/src/wp-includes/class-wp-image-editor-imagick.php @@ -550,7 +550,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { $this->image->rotateImage( new ImagickPixel('none'), 360-$angle ); // Normalise Exif orientation data so that display is consistent across devices. - $this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT ); + if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) { + $this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT ); + } // Since this changes the dimensions of the image, update the size. $result = $this->update_size();