WordPress / performance

Performance plugin from the WordPress Performance Group, which is a collection of standalone performance modules.
https://wordpress.org/plugins/performance-lab/
GNU General Public License v2.0
339 stars 92 forks source link

Limit WebP image dimensions #588

Open adamdunnage opened 1 year ago

adamdunnage commented 1 year ago

Feature Description

As mentioned by a user in the support forum, would it be possible to add a filter or option to allow users to limit WebP image dimensions. For example: limiting any WebP images created to 1024x1024px.

We do have a similar filter that can limit the number image sizes to generate webp images at:

add_filter(
    'webp_uploads_image_sizes_with_additional_mime_type_support',
    function( $sizes ) {
        $sizes['allowed_size_400x300'] = true;
        return $sizes;
    }
);

So would it be possible to add something similar for the image dimensions?

adamsilverstein commented 2 months ago

limit WebP image dimensions. For example: limiting any WebP images created to 1024x1024px.

@adamdunnage Would this be used in the mode where both JPEG and WebP are generated? I will check if this is already possible with the current filters.

adamdunnage commented 2 months ago

@adamsilverstein Yes, if that is possible then that would be helpful I believe. Thanks for checking!