WPIntell

Source evidence

Only JPG File converts what to do for PNG Images

Performance Lab · review · 2023-10-22T06:51:00+00:00

praisesentiment
mediumseverity
0.67relevance
5replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

7 / 33 rows with source links

21.2% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

26 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

review · 5 stars
loanpaye unresolved
How to convert PNG images into webp this plugin only convert jpg images please support or provide me any solution Hi @loanpaye – You can use the webp_uploads_upload_image_mime_transforms filter to add additional mime transforms. Something like: add_filter( webp_uploads_upload_image_mime_transforms function( $transforms ) { $transforms['image/png'] = 'image/webp'; return $transforms; } ); This reply was modified 2 years, 7 months ago by Adam Silverstein . The above code doesn’t work, I tried to fix it but it still doesn’t work add_filter('webp_uploads_upload_image_mime_transforms', function($transforms) { $transforms['image/png'] = 'image/webp'; return $transforms; }); This reply was modified 2 years, 7 months ago by Dao Anh . And what about those images which is already present in site or server They also automatically generated into webp Meanwhile i am talking here if some images are already i uploaded and than after that i installed this plugin so this plugin may convert already uploaded images into webp or i need to upload them again And also tell me where to place this code add_filter( webp_uploads_upload_image_mime_transforms function( $transforms ) { $transforms[‘image/png’] = ‘image/webp’; return $transforms; } ); @loanpaye Can you try the below. Regarding where to place this, you can insert into a custom functions plugin or a child themes functions.php file. function webp( $transforms ) { $transforms['image/png'] = array( 'image/png','image/webp'); return $transforms; } add_filter( 'webp_uploads_upload_image_mime_transforms', 'webp' ); In relation to existing images, there is an open GitHub issue to provide this functionality which is currently being worked on. Feel free to subscribe to that issue for updates. If you prefer not to wait, I believe there are some third party plugins out there which can provide that functionality.

Comments

5 shown
Adam Silverstein 2023-10-22T17:51:00+00:00

Hi @loanpaye – You can use the webp_uploads_upload_image_mime_transforms filter to add additional mime transforms. Something like: add_filter( webp_uploads_upload_image_mime_transforms function( $transforms ) { $transforms['image/png'] = 'image/webp'; return $transforms; } ); This reply was modified 2 years, 7 months ago by Adam Silverstein .

Dao Anh 2023-10-26T08:43:00+00:00

The above code doesn’t work, I tried to fix it but it still doesn’t work add_filter('webp_uploads_upload_image_mime_transforms', function($transforms) { $transforms['image/png'] = 'image/webp'; return $transforms; }); This reply was modified 2 years, 7 months ago by Dao Anh .

loanpaye 2023-10-29T01:59:00+00:00

And what about those images which is already present in site or server They also automatically generated into webp Meanwhile i am talking here if some images are already i uploaded and than after that i installed this plugin so this plugin may convert already uploaded images into webp or i need to upload them again

loanpaye 2023-10-29T02:09:00+00:00

And also tell me where to place this code add_filter( webp_uploads_upload_image_mime_transforms function( $transforms ) { $transforms[‘image/png’] = ‘image/webp’; return $transforms; } );

James Osborne 2023-11-01T15:11:00+00:00

@loanpaye Can you try the below. Regarding where to place this, you can insert into a custom functions plugin or a child themes functions.php file. function webp( $transforms ) { $transforms['image/png'] = array( 'image/png','image/webp'); return $transforms; } add_filter( 'webp_uploads_upload_image_mime_transforms', 'webp' ); In relation to existing images, there is an open GitHub issue to provide this functionality which is currently being worked on. Feel free to subscribe to that issue for updates. If you prefer not to wait, I believe there are some third party plugins out there which can provide that functionality.