Media: Resolve fatal error on resize with ImageMagick < 6.4.6

Improper checking for 'Imagick::ALPHACHANNEL_UNDEFINED' and
'Imagick::ALPHACHANNEL_OPAQUE' caused fatal errors for some users
with Imagick when compiled against ImageMagick < 6.4.6, when these
constants were introduced. Fixes these compatibility checks.

Props gblsm.
Fixes #36501.

git-svn-id: https://develop.svn.wordpress.org/trunk@37192 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mike Schroder 2016-04-13 06:17:25 +00:00
parent 1af1c2d30f
commit 09e9e53c30
1 changed files with 2 additions and 2 deletions

View File

@ -376,8 +376,8 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
*/
if ( is_callable( array( $this->image, 'getImageAlphaChannel' ) )
&& is_callable( array( $this->image, 'setImageAlphaChannel' ) )
&& defined( Imagick::ALPHACHANNEL_UNDEFINED )
&& defined( Imagick::ALPHACHANNEL_OPAQUE )
&& defined( 'Imagick::ALPHACHANNEL_UNDEFINED' )
&& defined( 'Imagick::ALPHACHANNEL_OPAQUE' )
) {
if ( $this->image->getImageAlphaChannel() === Imagick::ALPHACHANNEL_UNDEFINED ) {
$this->image->setImageAlphaChannel( Imagick::ALPHACHANNEL_OPAQUE );