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
This commit is contained in:
Anthony Burchell 2024-06-14 15:24:32 +00:00
parent 36ee9bde3e
commit 738c03d5b9

View File

@ -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 );