From 150a1f78bec1c2438ea38d8150aa3108fdfa41a4 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Wed, 31 Jul 2024 08:23:11 -0600 Subject: [PATCH 01/15] Also convert PNGs --- plugins/webp-uploads/helper.php | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/webp-uploads/helper.php b/plugins/webp-uploads/helper.php index 842aad737..ced30c2cb 100644 --- a/plugins/webp-uploads/helper.php +++ b/plugins/webp-uploads/helper.php @@ -29,6 +29,7 @@ function webp_uploads_get_upload_image_mime_transforms(): array { 'image/jpeg' => array( 'image/' . $output_format ), 'image/webp' => array( 'image/webp' ), 'image/avif' => array( 'image/avif' ), + 'image/png' => array( 'image/' . $output_format ), ); // Check setting for whether to generate both JPEG and the modern output format. From 358e1bf26293e392b858b5bcbcb2608d941d4bd2 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Wed, 31 Jul 2024 11:42:25 -0600 Subject: [PATCH 02/15] Adjust defaults for test_it_should_return_default_transforms_when_filter_returns_non_array_type test --- plugins/webp-uploads/tests/test-helper.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/webp-uploads/tests/test-helper.php b/plugins/webp-uploads/tests/test-helper.php index a0d6b761c..4dba070b5 100644 --- a/plugins/webp-uploads/tests/test-helper.php +++ b/plugins/webp-uploads/tests/test-helper.php @@ -367,12 +367,14 @@ public function test_it_should_return_default_transforms_when_filter_returns_non 'image/jpeg' => array( 'image/avif' ), 'image/webp' => array( 'image/webp' ), 'image/avif' => array( 'image/avif' ), + 'image/png' => array( 'image/avif' ), ); } else { $default_transforms = array( 'image/jpeg' => array( 'image/webp' ), 'image/webp' => array( 'image/webp' ), 'image/avif' => array( 'image/avif' ), + 'image/png' => array( 'image/webp' ), ); } From 7c5d47de12e52547674b8bf79020feaa548cc8c2 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Thu, 8 Aug 2024 08:01:07 -0600 Subject: [PATCH 03/15] Change language for fallback toggle, removing JPEG references --- plugins/webp-uploads/settings.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/webp-uploads/settings.php b/plugins/webp-uploads/settings.php index dd8c8ed16..5a5d837b7 100644 --- a/plugins/webp-uploads/settings.php +++ b/plugins/webp-uploads/settings.php @@ -173,11 +173,11 @@ function webp_uploads_generate_webp_jpeg_setting_callback(): void { ?> -

+

Date: Mon, 26 Aug 2024 12:09:51 -0600 Subject: [PATCH 12/15] small language fine tuning --- plugins/webp-uploads/readme.txt | 2 +- plugins/webp-uploads/settings.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/webp-uploads/readme.txt b/plugins/webp-uploads/readme.txt index 74ddd8a55..e53deb792 100644 --- a/plugins/webp-uploads/readme.txt +++ b/plugins/webp-uploads/readme.txt @@ -13,7 +13,7 @@ Converts images to more modern formats such as WebP or AVIF during upload. This plugin adds WebP and AVIF support for media uploads within the WordPress application. By default, AVIF images will be generated if supported on the hosting server, otherwise WebP will be used as the output format. When both formats are available, the output format can be selected under `Settings > Media`. Modern images will be generated only for new uploads, pre-existing images will only converted to a modern format if images are regenerated. Images can be regenerated with a plugin like [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) or via WP-CLI with the `wp media regenerate` [command](https://developer.wordpress.org/cli/commands/media/regenerate/). -By default, only modern image format sub-sizes will be generated for JPEG uploads - only the original uploaded file will still exist as a JPEG image, generated image sizes use be WebP or AVIF files. To change this behavior, there is a checkbox in `Settings > Media` "Output fallback images" that - when checked - will result in the plugin generating both the original forman as well as WebP or AVIF images for every sub-size (noting again that this will only affect newly uploaded images, i.e. after making said change). +By default, only modern image format sub-sizes will be generated for JPEG or PNG uploads - only the original uploaded file will still exist as a JPEG/PNG image, generated image sizes will be WebP or AVIF files. To change this behavior, there is a checkbox in `Settings > Media` "Output fallback images" that - when checked - will result in the plugin generating both the original format as well as WebP or AVIF images for every sub-size (noting again that this will only affect newly uploaded images, i.e. after making said change). _This plugin was formerly known as WebP Uploads._ diff --git a/plugins/webp-uploads/settings.php b/plugins/webp-uploads/settings.php index 3740c7012..894044af8 100644 --- a/plugins/webp-uploads/settings.php +++ b/plugins/webp-uploads/settings.php @@ -230,7 +230,7 @@ function webp_uploads_use_picture_element_callback(): void {

img).', 'webp-uploads' ); ?>

> -

+