• Resolved satheeshrajv

    (@satheeshrajv)


    Hi,

    Is there any way to convert only featured image to webp with this plugin?

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @satheeshrajv,

    Thank you for your message.

    One image in the Media Library means several or more than a dozen files in the /uploads directory, because WordPress automatically generates additional files from one uploaded file, in different sizes. The plugin optimizes all files from the /uploads directory.

    What files would you like to leave out of this optimization and why?

    Best,
    Mateusz

    Thread Starter satheeshrajv

    (@satheeshrajv)

    Hi Mateuze,

    I want to convert all the featured images and don’t want to pick the images which are inside post because those images are small in size and won’t cause issue.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @satheeshrajv I understand you. Unfortunately, this is not possible – our plugin optimizes all images from the /uploads directory. In our opinion, this guarantees the best results – especially since the theme uses images of different sizes.

    Thread Starter satheeshrajv

    (@satheeshrajv)

    Converting all size featured image is not an issue for me. Is there any hook we can insert to skip the images which are inside the post?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @satheeshrajv It is not possible. Images are optimized in the plugin’s settings panel, not when they are displayed on the page, so it doesn’t matter where they are displayed.

    Thread Starter satheeshrajv

    (@satheeshrajv)

    All my featured image dimension is 1280×720. So can we filter the images based on this dimension?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @satheeshrajv If the file name contains the “-1280×720” suffix (example file name image-1280×720.jpg), you can add the following filter to the functions.php file in your theme directory:

    add_filter( 'webpc_supported_source_file', function( bool $status, string $file_name, string $server_path ): bool {
        if ( strpos( $file_name, '-1280x720.' ) === false ) {
            return false;
        }
        return $status;
    }, 10, 3 );

    This should work as you expect.

    Thread Starter satheeshrajv

    (@satheeshrajv)

    Actually I need the hook during bulk optimization. Will the code provide by you works with bulk optimization?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @satheeshrajv Yes! This filter must be added before running bulk optimization. After adding it, the number of images to be optimized in the “Bulk Optimization of Images” section should be reduced.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Only Featured image’ is closed to new replies.