Make WordPress Core

Changeset 51435 for trunk


Ignore:
Timestamp:
07/15/2021 12:41:44 AM (3 years ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-image-editor-imagick.php

    r51298 r51435  
    206206                    $webp_info = wp_get_webp_info( $this->file );
    207207
    208                     if ( 'lossy' === $webp_info['type'] ) {
    209                         $this->image->setImageCompressionQuality( $quality );
    210                     } else {
     208                    if ( 'lossless' === $webp_info['type'] ) {
    211209                        // Use WebP lossless settings.
    212210                        $this->image->setImageCompressionQuality( 100 );
    213211                        $this->image->setOption( 'webp:lossless', 'true' );
     212                    } else {
     213                        $this->image->setImageCompressionQuality( $quality );
    214214                    }
    215215                    break;
Note: See TracChangeset for help on using the changeset viewer.