Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Expand to fit going mad on image field

Avatar

Former Community Member

Hi

I have an image field for showing images that might be different shapes.  Regardless of the shape of the image I always need it to be the width I set in the designer and then vertically expand as needed to keep the same proportion.

To do this I've set Sizing to "Scale Image Proportionally" and I've ticked Expand to Fit for Height, but not Width.  Unfortunately when I do this I'm getting incredibly tall (several pages big) image fields which are mostly empty.  I think what might be happening is that the image is very large height is being set before the image is shrunk to fit the width.

Does anyone know a way to make the image field only expand vertically as far as is necessary for the image to fit the width of the field?

Thanks

Dan

6 Replies

Avatar

Level 10

Hi,

I think you'll have problems with this. I see the same behaviour here and I suspect that the image field cannot cope with expand to fit height.

I also tried scripting a minimum height (this.minH) but that showed the same behaviour as well. While minH works well for textfields, it just extends the height of the imageField beyond the page.

Good luck,

Niall

Avatar

Former Community Member

Damn - That really wasn't the answer I wanted to hear.

Thanks

Avatar

Level 1

Bummer.  I'm having the same problem.  Argh.

Avatar

Level 10

Hi,

I know this is not what the original thread was looking for, but it shows how you can scale images at runtime: http://assure.ly/i8ZI5Y

Niall

Avatar

Level 1

Thanks--not sure if I can rig that to work for what I need though; my image field is within a repeating subform and the xfa.layout call happens on the master page so I'd have to somehow get the subform index information to the call...  I haven't given up yet, but it sure would be nice if the resize just worked in the first place!!