Add "Upscale smaller images" option to Resolutions

We'd like to be able to prevent images from being upscaled by Resolutions, for them to only be downscaled when appropriate, and otherwise to be left alone.


So, in this mockup, with the "Upscale smaller images" option unticked, if an image is 700px wide it will be downscaled to 600px, but if it's 500px wide it will be left as it is, it'll be up to us to provide an image with larger dimensions.

If the "Upscale smaller images" option is ticked, the current FirstSpirit behaviour would occur, where the 500px wide image is upscaled to 600px.

If this is already possible, please let me know.

1 Comment
Crownpeak employee
Crownpeak employee

You can just check the picture dimension within the template and decide there, which resolution should be used.

Example code:

$CMS_IF(ref(myPic).width > 600)$<img src="$CMS_REF(myPic,resolution:"image600w")$"...>

$CMS_ELSE$<img src="$CMS_REF(myPic)$"...>