ResponsiveImagesCG/wp-tevko-responsive-images

Incorrect srcset for retina images in 3.1.0

Closed this issue · 1 comments

Hi again,

I've installed the latest update to 3.1.0, and now all the pictures across our entire site that looked so beautiful on my 13" retina display are now blurry.

Example post

There are several images here (e.g. the snowy forest one) that span the entire width of the screen. Using Chrome's web inspector, I can identify that the currentSrc I am being served is 1024x681. In previous versions of the plugin, I was being served the full size of the image, so this looked nice and sharp. I'm assuming something in the srcset generation changed, but I'm not really sure what.

@TedAvery

This is because we added $max_srcset_image_width and its default value is 1600. You can change this value with the max_srcset_image_width filter hook:

function my_max_srcset_image_width( $max_width ) {
    return 2048;
}
add_filter( 'max_srcset_image_width', 'my_max_srcset_image_width' );

When you add that to your functions.php it will change the maximum to 2048px.

If you use even larger images on your site I would recommend to not increase the limit even more, but add a custom image size with a width of 2048 (add_image_size( 'my_hd_img_size', 2048, 2048, false ); + regenerate thumbnails) instead. That's better than including a very large uncompressed image just for HD.