This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Outout WebP sub size images. | |
* | |
* @wordpress-plugin | |
* Plugin Name: WebP-only. | |
* Description: Output WebP sub size images. | |
* Plugin URI: | |
* Version: 1.0.0 | |
* Author: Adam Silverstein, Google |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Output only WebP sub size images. | |
* | |
* @wordpress-plugin | |
* Plugin Name: WebP-only. | |
* Description: Output only WebP sub size images. | |
* Plugin URI: | |
* Version: 1.0.0 | |
* Author: Adam Silverstein, Google |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use the `wp_editor_set_quality` filter for testing. | |
*/ | |
function set_webp_quality() { | |
return 82; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use the `wp_editor_set_quality` filter for testing. | |
*/ | |
function set_webp_quality( $quality, $mime_type ) { | |
error_log( sprintf( 'wp_editor_set_quality mime type: %s', $mime_type ) ); | |
if ( 'image/webp' === $mime_type ) { | |
return 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
has_webp, | |
APPROX_QUANTILES(bytesImg, 1000)[OFFSET(500)] / 1024 / 1024 AS median_img_mbytes | |
FROM ( | |
SELECT DISTINCT | |
url, | |
info AS version | |
FROM | |
`httparchive.technologies.2022_07_01_mobile` | |
WHERE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
mobile.version, | |
ROUND(pct_webp_mobile, 3) AS pct_webp_mobile, | |
ROUND(pct_webp_desktop, 3) AS pct_webp_desktop | |
FROM | |
( | |
SELECT | |
version, pct_webp AS pct_webp_mobile | |
FROM | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/wp-includes/class-wp-image-editor.php b/src/wp-includes/class-wp-image-editor.php | |
index 6b63d7e9fd..e17b787223 100644 | |
--- a/src/wp-includes/class-wp-image-editor.php | |
+++ b/src/wp-includes/class-wp-image-editor.php | |
@@ -414,12 +414,10 @@ abstract class WP_Image_Editor { | |
$filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}"; | |
} | |
- if ( $mime_type && ( $mime_type !== $this->mime_type ) ) { | |
- // The image will be converted when saving. Set the quality for the new mime-type if not already set. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function( d, i, s, p ) { | |
s = d.createElement( s ); | |
s.src = '{$fallback_url}'; | |
i = d.createElement( i ); | |
i.src = p + 'jIAAABXRUJQVlA4ICYAAACyAgCdASoCAAEALmk0mk0iIiIiIgBoSygABc6zbAAA/v56QAAAAA=='; | |
i.onload = function() { | |
i.src = p + 'h4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA='; | |
}; | |
i.onerror = function() { | |
d.body.appendChild( s ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
mobile.version, | |
ROUND(pct_webp_mobile, 3) AS pct_webp_mobile, | |
ROUND(pct_webp_desktop, 3) AS pct_webp_desktop | |
FROM | |
( | |
SELECT | |
version, pct_webp AS pct_webp_mobile | |
FROM | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ ll | |
total 45600 | |
166K 2 14:14 sample0-1024x576.jpg | |
118K 2 14:14 sample0-1024x576.webp | |
168K 2 14:14 sample0-1038x576.jpg | |
120K 2 14:15 sample0-1038x576.webp | |
28K 2 14:14 sample0-150x150.jpg | |
7.0K 2 14:14 sample0-150x150.webp | |
304K 2 14:14 sample0-1536x864.jpg | |
220K 2 14:15 sample0-1536x864.webp |