Conversation
review · 5 starsHow 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.
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.