Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert WebP to AVIF on upload #1557

Open
phanduynam opened this issue Sep 24, 2024 · 6 comments
Open

Convert WebP to AVIF on upload #1557

phanduynam opened this issue Sep 24, 2024 · 6 comments
Labels
[Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) [Type] Enhancement A suggestion for improvement of an existing feature

Comments

@phanduynam
Copy link

Modern Image Formats 2.2.0 does not support converting uploaded WebP files to AVIF

@github-project-automation github-project-automation bot moved this to Not Started/Backlog 📆 in WP Performance 2024 Sep 24, 2024
@mukeshpanchal27 mukeshpanchal27 changed the title Convert uploaded WebP files to AVIF Convert WebP to AVIF on upload Sep 24, 2024
@mukeshpanchal27 mukeshpanchal27 added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) labels Sep 24, 2024
@mukeshpanchal27
Copy link
Member

Thanks, @phanduynam, for raising this issue.

Currently the plugin didn't added support for WebP to AVIF image but in future if possible we can add it.

cc. @adamsilverstein

@phanduynam
Copy link
Author

@mukeshpanchal27 Thanks, I'm looking forward to this.

@adamsilverstein
Copy link
Member

Currently the plugin didn't added support for WebP to AVIF image but in future if possible we can add it.

This should be a relatively small change. No new UI is needed, if the selected output format is AVIF and users upload a WebP we can convert them.

@mukeshpanchal27 Thanks, I'm looking forward to this.

@phanduynam I'm curious about your use case / why you have WebP's you are trying to upload in the first place. It makes sense to "upgrade" to AVIF, but I thought most users would be coming from JPEGs.

@phanduynam
Copy link
Author

Currently the plugin didn't added support for WebP to AVIF image but in future if possible we can add it.

This should be a relatively small change. No new UI is needed, if the selected output format is AVIF and users upload a WebP we can convert them.

@mukeshpanchal27 Thanks, I'm looking forward to this.

@phanduynam I'm curious about your use case / why you have WebP's you are trying to upload in the first place. It makes sense to "upgrade" to AVIF, but I thought most users would be coming from JPEGs.

I'm doing a website crawl, there will be webp images, but I want them all converted to avif. Simple as that

@mukeshpanchal27
Copy link
Member

Currently the plugin didn't added support for WebP to AVIF image but in future if possible we can add it.

This should be a relatively small change. No new UI is needed, if the selected output format is AVIF and users upload a WebP we can convert them.

This change fix the WebP to AVIF transforms.

diff --git a/plugins/webp-uploads/helper.php b/plugins/webp-uploads/helper.php
index 7669154b..d4a5047b 100644
--- a/plugins/webp-uploads/helper.php
+++ b/plugins/webp-uploads/helper.php
@@ -28,7 +28,7 @@ function webp_uploads_get_upload_image_mime_transforms(): array {
 
        $default_transforms = array(
                'image/jpeg' => array( 'image/' . $output_format ),
-               'image/webp' => array( 'image/webp' ),
+               'image/webp' => array( 'image/' . $output_format ),
                'image/avif' => array( 'image/avif' ),
                'image/png'  => array( 'image/' . $output_format ),
        );

@phanduynam
Copy link
Author

phanduynam commented Nov 14, 2024

@adamsilverstein I would like to know if this add-on applies to the 18/11 update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) [Type] Enhancement A suggestion for improvement of an existing feature
Projects
Status: Not Started/Backlog 📆
Development

No branches or pull requests

3 participants