Image size is not respected on frontend because of wrong srcset

Cwicly Plugin version:


When selecting an image size in editor, srcset should be set accordingly on frontend, but they actually include all sizes.

So with large screen/window, large images are loaded instead of the requested size only.

Solution: srcset above the selected size should not be output.

NOTE: The “remove srcset” toggle is not an option, since it’s not responsive at all.

Hi @yankiara,

You are correct, the sizes attribute is missing. This joins some of the other posts posted here about this specific issue.
Our next update will be retaining the sizes attribute and should allow the browser to select the correct source without having to modify the srcset.



Out of curiosity, why even generate the srcset which are above the max size?
I see that WP does the same for the Gutenberg image block.

Is this because it is easier than filtering them?

I could be wrong, but I’m guessing it is because iPads, for instance, have such a high resolution that images that are twice the size specified look better.

And you could be very right :slight_smile:
I actually read that browsers detect devices pixel density and automatically choose the right image dimension, which allows not to bother with 2x modifier.