It doesn’t seem like the new image_tag generates srcsets completely correctly. And I’m trying to figure out if I’m missing something or it’s the tag.
I’ve got a slider for related collections - and it puts in square images. This is
{{ collection.image
| image_url: width: 350, height: 350, crop: 'center'
| image_tag:
widths: "200, 250, 300, 350",
sizes: "350px, (max-width:1400px) 300px, (max-width: 768px) 250px, (max-width: 480px) 200px"
}}
On large screens, the blocks are 350px, and then on smaller screens, they’re smaller boxes.
The rendered output of this tag looks like this:
Which is wrong. The widths are correct on the items in the srcset, but the heights are all the same at 350px. According to the help doc, there’s only widths settings for the image_tag part, not heights.
In short, WTF?
I can do it the old way, but I’d rather use the new image tag.
Bonus question:
How do I get retina sizes to show up in there? On a large retina screens, the largest size should be loading a 700px square image (2x dimensions for retina), but this image tag doesn’t do that. Even though my originals are large enough, the srcset doesn’t load images larger than 350px square.
Note: This bit of code below works, but I want to do it with the image_url and image_tag.