3

I am using ContextualMediaHelper with DXA 2.2 solution. To avoid cropping of images, I want to use fit instead of scale with CID service. I can see scale is appended in the responsive image URL configuration hardcoded within ContextuaMediaHelper.cs class file.

enter image description here

Wondering if there is any other way except creating custom Media helper to use fit in the responsive URL.

1 Answer 1

3

You already found yourself that use of “scale” is hard-coded in ContextualMediaHelper. But you can also see that it is a property, which is set with a hard-coded value in the constructor.

So, a custom MediaHelper can be very minimal: create a subclass of ContextualMediaHelper which only has a constructor which sets the ImageResizeUrlFormat to the desired value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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