• How to convert PNG images into webp this plugin only convert jpg images

    please support or provide me any solution

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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;
    } );

    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 1 year, 1 month ago by Dao Anh.
    Thread Starter loanpaye

    (@loanpaye)

    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

    Thread Starter loanpaye

    (@loanpaye)

    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; } );

    Plugin Support James Osborne

    (@jamesosborne)

    @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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Only JPG File converts what to do for PNG Images’ is closed to new replies.