WordPress.org

Make WordPress Core

Changeset 51437


Ignore:
Timestamp:
07/15/2021 01:00:46 PM (2 weeks ago)
Author:
desrosj
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, azaozz.
Merges [51435] to the 5.8 branch.
Fixes #53653.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-includes/class-wp-image-editor-imagick.php

    r50821 r51437  
    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.