How to set explicit width and height attributes on image elements in CMS Image Gallery or Multi-reference Fields

When using dynamic CMS Image Gallery or a Multi-reference Field (that is linked to an image collection set) there is no ability to explicitly set the width and height of different size images.

For example (see below) an image in the CMS gallery can be a portrait size image with 500px height and 375px width while another image in the CMS gallery can be landscape proportions with 450px height and 600px width.

There is no way to set explicit width and height on image elements of different dimensions when using CMS Image Gallery or Multi-reference Field.
Does anyone have a solution or workaround for this?

1 Like

Hey hey,

is it mandatory to set explicit dimensions for you?
You could just add a class to the images and set dimensions there? Maybe even relatively sized units?

The images are apart of a CMS Image Gallery field. If a class to one of these images were set, then it would apply to all images in the gallery.

The question above refers to explicitly sizing an image using the width and height attribute of an image tag. Whether it’s mandatory or not to set explicit dimensions is unimportant to the core of this post; notwithstanding feel free to read more about its importance here (<- article related to setting width and height).

1 Like

Interested to know if anyone has found a solution for this topic :slightly_smiling_face: