Closed sam327 closed 5 years ago
Not sure if that's a good idea, but you can easily achieve this by getting the width from the asset like:
{% set transformedImages = craft.imager.transformImage(img, [
{ width: img.getWidth() },
{ width: 1600 },
{ width: 1200 },
{ width: 720 },
{ width: 480 },
]
)
%}
Don't see any reason to add a special case for this inside Imager.
I'm not 100% sure either. But I'm willing to test it out, if only to show before and after comparisons to the boss.
At any rate, that one line was exactly I was looking for. Thank you.
I've got image building out srcsets, and it's working out well. But I've got a question / request.
So, my code's pretty standard... looks something like this:
But I'd like to be able to put in another variable to the srcset, like { width: original }, that would add the original size at the top of the list with its width, so that if the screen gets really wide, it has the ability to pull the original size.
So, if my image is 2237px wide, the set would have _/imager/images/image.jpg 2237w, /imager/images/image_1600.jpg 1600w, /imager/images/image1200.jpg 1200w, ... and so on
That all make sense?