From e0d47a45b162b2969c45c4883c99695409f3d8b5 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Thu, 17 Oct 2024 17:05:18 +0000 Subject: [PATCH] Media: Ensure Imagick quality is set correctly. Fix an issue where Imagick did not properly set image quality for AVIF images. Adds a call to `setCompressionQuality` where we currently call `setImageCompressionQuality` Props: jamesosborne, adamsilverstein, mukeshpanchal27. Fixes: #61614. Built from https://develop.svn.wordpress.org/trunk@59247 git-svn-id: http://core.svn.wordpress.org/trunk@58639 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-image-editor-imagick.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index bb3f903120..81591dd981 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -206,6 +206,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { switch ( $this->mime_type ) { case 'image/jpeg': $this->image->setImageCompressionQuality( $quality ); + $this->image->setCompressionQuality( $quality ); $this->image->setImageCompression( imagick::COMPRESSION_JPEG ); break; case 'image/webp': @@ -214,19 +215,23 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { if ( 'lossless' === $webp_info['type'] ) { // Use WebP lossless settings. $this->image->setImageCompressionQuality( 100 ); + $this->image->setCompressionQuality( 100 ); $this->image->setOption( 'webp:lossless', 'true' ); parent::set_quality( 100 ); } else { $this->image->setImageCompressionQuality( $quality ); + $this->image->setCompressionQuality( $quality ); } break; case 'image/avif': // Set the AVIF encoder to work faster, with minimal impact on image size. $this->image->setOption( 'heic:speed', 7 ); $this->image->setImageCompressionQuality( $quality ); + $this->image->setCompressionQuality( $quality ); break; default: $this->image->setImageCompressionQuality( $quality ); + $this->image->setCompressionQuality( $quality ); } } catch ( Exception $e ) { return new WP_Error( 'image_quality_error', $e->getMessage() ); diff --git a/wp-includes/version.php b/wp-includes/version.php index baa7e31233..80d31d7dce 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-beta3-59246'; +$wp_version = '6.7-beta3-59247'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.