From 738c03d5b94e28eea3b836b46a98bf65178ecf2a Mon Sep 17 00:00:00 2001 From: Anthony Burchell Date: Fri, 14 Jun 2024 15:24:32 +0000 Subject: [PATCH] Media: Revert r58415 Use `version_compare()` for Imagick version check when removing alpha. This commit is a clean revert of r58415 as tests seem to now be failing with this change. Likely the test needs an update as well to accomodate the new successful version check. Follow-up to [60798]. Props jorbin, hellofromTonya. See #60798. git-svn-id: https://develop.svn.wordpress.org/trunk@58417 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-image-editor-imagick.php | 3 ++- 1 file changed, 2 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 eac302d7ce..d38ee6fd63 100644 --- a/src/wp-includes/class-wp-image-editor-imagick.php +++ b/src/wp-includes/class-wp-image-editor-imagick.php @@ -775,8 +775,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * @since 6.4.0 */ protected function remove_pdf_alpha_channel() { + $version = Imagick::getVersion(); // Remove alpha channel if possible to avoid black backgrounds for Ghostscript >= 9.14. RemoveAlphaChannel added in ImageMagick 6.7.5. - if ( version_compare( phpversion( 'imagick' ), '9.14', '>=' ) ) { + if ( $version['versionNumber'] >= 0x675 ) { try { // Imagick::ALPHACHANNEL_REMOVE mapped to RemoveAlphaChannel in PHP imagick 3.2.0b2. $this->image->setImageAlphaChannel( defined( 'Imagick::ALPHACHANNEL_REMOVE' ) ? Imagick::ALPHACHANNEL_REMOVE : 12 );