Media: When resizing WebP images set the compression to "lossy" by default. Fixes a bug where the compression was set to "lossless" when the uploaded WebP images have extended file format (`VP8X`).
Props adamsilverstein, mikeschroder, mmxxi, linux4me2. Fixes #53653. Built from https://develop.svn.wordpress.org/trunk@51435 git-svn-id: http://core.svn.wordpress.org/trunk@51046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
88cedeac5c
commit
15f9f7c6b9
|
@ -205,12 +205,12 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||||
case 'image/webp':
|
case 'image/webp':
|
||||||
$webp_info = wp_get_webp_info( $this->file );
|
$webp_info = wp_get_webp_info( $this->file );
|
||||||
|
|
||||||
if ( 'lossy' === $webp_info['type'] ) {
|
if ( 'lossless' === $webp_info['type'] ) {
|
||||||
$this->image->setImageCompressionQuality( $quality );
|
|
||||||
} else {
|
|
||||||
// Use WebP lossless settings.
|
// Use WebP lossless settings.
|
||||||
$this->image->setImageCompressionQuality( 100 );
|
$this->image->setImageCompressionQuality( 100 );
|
||||||
$this->image->setOption( 'webp:lossless', 'true' );
|
$this->image->setOption( 'webp:lossless', 'true' );
|
||||||
|
} else {
|
||||||
|
$this->image->setImageCompressionQuality( $quality );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.9-alpha-51434';
|
$wp_version = '5.9-alpha-51435';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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