Dynamic image viewer size

Hi,  On a document template page I use dynamic image viewer to allow users to show their uploaded Logo on pdf.  The dynamic image viewer requires to set a height OR a width. Since logos come in different shapes, if I set the height then the portrait/square logos are okay but the landscape ones are way too big, and the other way around if I set the width, then portrait/square logos are too small, and the landscape are okay.    My question: Can a set up a max-width and a max-height for the document viewer somehow, so then the image should not exceed them, have 2 constraints not 1?  Or any other hacks that bring same result?    Thanks:)       
1 answers

Hi Ana,

This is indeed a challenge especially with the option in the document template. I think what I have done in the past is get the image dimension with the GetImageDimensions java action from the community commons module. Then depending on the height and with from the image use a helper object to either show a dynamic image that either has the height or width set.

That way you can kind of determine if it is portrait or landscape and how the image should be best shown.

Hope this helps!​​​​​​​