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
This commit is contained in:
parent
bd1a653f42
commit
e0d47a45b1
|
@ -206,6 +206,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||||
switch ( $this->mime_type ) {
|
switch ( $this->mime_type ) {
|
||||||
case 'image/jpeg':
|
case 'image/jpeg':
|
||||||
$this->image->setImageCompressionQuality( $quality );
|
$this->image->setImageCompressionQuality( $quality );
|
||||||
|
$this->image->setCompressionQuality( $quality );
|
||||||
$this->image->setImageCompression( imagick::COMPRESSION_JPEG );
|
$this->image->setImageCompression( imagick::COMPRESSION_JPEG );
|
||||||
break;
|
break;
|
||||||
case 'image/webp':
|
case 'image/webp':
|
||||||
|
@ -214,19 +215,23 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||||
if ( 'lossless' === $webp_info['type'] ) {
|
if ( 'lossless' === $webp_info['type'] ) {
|
||||||
// Use WebP lossless settings.
|
// Use WebP lossless settings.
|
||||||
$this->image->setImageCompressionQuality( 100 );
|
$this->image->setImageCompressionQuality( 100 );
|
||||||
|
$this->image->setCompressionQuality( 100 );
|
||||||
$this->image->setOption( 'webp:lossless', 'true' );
|
$this->image->setOption( 'webp:lossless', 'true' );
|
||||||
parent::set_quality( 100 );
|
parent::set_quality( 100 );
|
||||||
} else {
|
} else {
|
||||||
$this->image->setImageCompressionQuality( $quality );
|
$this->image->setImageCompressionQuality( $quality );
|
||||||
|
$this->image->setCompressionQuality( $quality );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'image/avif':
|
case 'image/avif':
|
||||||
// Set the AVIF encoder to work faster, with minimal impact on image size.
|
// Set the AVIF encoder to work faster, with minimal impact on image size.
|
||||||
$this->image->setOption( 'heic:speed', 7 );
|
$this->image->setOption( 'heic:speed', 7 );
|
||||||
$this->image->setImageCompressionQuality( $quality );
|
$this->image->setImageCompressionQuality( $quality );
|
||||||
|
$this->image->setCompressionQuality( $quality );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->image->setImageCompressionQuality( $quality );
|
$this->image->setImageCompressionQuality( $quality );
|
||||||
|
$this->image->setCompressionQuality( $quality );
|
||||||
}
|
}
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
return new WP_Error( 'image_quality_error', $e->getMessage() );
|
return new WP_Error( 'image_quality_error', $e->getMessage() );
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue