From 7b2335eb40410077e6d2fd8d8c02f8553b0a4ade Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 6 May 2021 11:10:57 +0000 Subject: [PATCH] Media: Remove `_wp_webp_is_lossy()` for now. The function was only used in a single place in core. Follow-up to [50810], [50814], [50815], [50818]. Props johnjamesjacoby. See #35725. Built from https://develop.svn.wordpress.org/trunk@50819 git-svn-id: http://core.svn.wordpress.org/trunk@50428 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-image-editor-imagick.php | 5 ++++- wp-includes/media.php | 15 --------------- wp-includes/version.php | 2 +- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index 36a344b15b..19e168edb0 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -203,7 +203,10 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { $this->image->setImageCompression( imagick::COMPRESSION_JPEG ); break; case 'image/webp': - if ( _wp_webp_is_lossy( $this->file ) ) { + $webp_info = wp_get_webp_info( $this->file ); + $type = $webp_info['type']; + + if ( $type && 'lossy' === $type ) { $this->image->setImageCompressionQuality( $quality ); } else { // Use WebP lossless settings. diff --git a/wp-includes/media.php b/wp-includes/media.php index 037b4dfebe..c1dc3886f7 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -5115,18 +5115,3 @@ function wp_get_webp_info( $filename ) { return compact( 'width', 'height', 'type' ); } - -/** - * Determines if a passed image is a lossy WebP image. - * - * @since 5.8.0 - * - * @param string $filename The file path. - * @return bool Whether the file is a lossy WebP file. - */ -function _wp_webp_is_lossy( $filename ) { - $webp_info = wp_get_webp_info( $filename ); - $type = $webp_info['type']; - - return $type && 'lossy' === $type; -} diff --git a/wp-includes/version.php b/wp-includes/version.php index 3a8f51dd4d..73e2319165 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-alpha-50818'; +$wp_version = '5.8-alpha-50819'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.