Lock image aspect ratio.

  • 9 October 2017
  • 5 replies
  • 10 views

Badge +1

I am working in an image library and am having difficulties with the image preview. Most of the files display correctly but large files do not (I only see the top left of the image).  The files need to be kept the sizes they are.  The properties only seem to allow me to modify via a % which distorts the image.  Does anyone know how I can lock the aspect ratio of the image and perhaps limit the frame size it shows in (as I don't want the form to explode in size). I have also tried responsive forms with no luck.

Any advice would be appreciated.

Raquel


5 replies

Userlevel 5
Badge +14

can you provide more details on your setup?

do you use image control to display preview?

or kind of trick with calculated value control?

or any other approach?

Badge +1

Hi Marian

Nothing fancy involved, just a straight image control. I have also tried it in a panel with various combinations of ‘resize at runtime’.

Thanks ☺

Userlevel 5
Badge +14

try to add CSS style like following into form settings >> custom CSS

.ImgPreview{
   display: block !important;
   max-width:400px  !important;
   max-height:300px !important;
   width: auto !important;
   height: auto !important;
}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

and configure class "ImgPreview" for your image control

‌  custom css‌‌ max size‌

Badge +1

Fantastic – thank you! Worked perfectly.

Userlevel 5
Badge +14

great!

please mark correct answer.

Reply