Changeset 50810 for trunk/src/wp-includes/class-wp-image-editor-imagick.php
- Timestamp:
- 05/04/2021 02:43:36 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-image-editor-imagick.php
r49927 r50810 198 198 199 199 try { 200 if ( 'image/jpeg' === $this->mime_type ) { 201 $this->image->setImageCompressionQuality( $quality ); 202 $this->image->setImageCompression( imagick::COMPRESSION_JPEG ); 203 } else { 204 $this->image->setImageCompressionQuality( $quality ); 200 switch ( $this->mime_type ) { 201 case 'image/jpeg': 202 $this->image->setImageCompressionQuality( $quality ); 203 $this->image->setImageCompression( imagick::COMPRESSION_JPEG ); 204 break; 205 case 'image/webp': 206 if ( _wp_webp_is_lossy( $this->file ) ) { 207 $this->image->setImageCompressionQuality( $quality ); 208 } else { 209 // Use WebP lossless settings. 210 $this->image->setImageCompressionQuality( 100 ); 211 $this->image->setOption( 'webp:lossless', 'true' ); 212 } 213 break; 214 default: 215 $this->image->setImageCompressionQuality( $quality ); 205 216 } 206 217 } catch ( Exception $e ) { 207 218 return new WP_Error( 'image_quality_error', $e->getMessage() ); 208 219 } 209 210 220 return true; 211 221 } 222 212 223 213 224 /**
Note: See TracChangeset
for help on using the changeset viewer.