7

I am using a Page Content Rendering with a custom variant to output an Image property. How could I control the dimensions of the raw image output.

2

There is no variant definition for an Image field (like there is for a Date field). This is definitely something that is missing in the current version of SXA - I do expect that it is on the roadmap though.

So with simple variants, I'm afraid you cannot scale the image (you could use css to control dimensions but that is not what you want to do).

You might be able to do this using NVelocity, but that will not be as user-friendly as a 'normal' variant definition.

2

In SXA 1.6,

Try using width and height in the Data Attributes field on the VariantField that is being used to render the image.

This seems to add the width and height attributes to the rendered image (including the url) and subsequently is scaled when the image handler is called.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.