Design and CSS styles
Version 5.x > Design and CSS styles > how to set image height width proportionally in kentico View modes: 
User avatar
Member
Member
gaurav.agrawal-octalsoftware - 6/2/2011 12:02:35 AM
   
how to set image height width proportionally in kentico
Hi,

I want to show image height width according to proportionally or aspect ratio.
But Kentico provides us fix height, width image by using GetImage() function and passed height and width.
Now i want to fixed its height and width will be automatically set as proportionally.

Thanks
Gaurav Agrawal

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 6/2/2011 6:14:51 AM
   
RE:how to set image height width proportionally in kentico
Hello,

I guess that you are about to setting up those proportions in the transformation, right? Moreover, you probably have the Attachment GUID of the image. In this case you will be able to develop a custom function to this transformation where you'll obtain an Attachment Info object which contains the real AttachmentImageWidth and AttachmentImageHeight values. Once you have the sizes of the image, you can write a script which will count another size according to the given width or height. You'll return both values back and you can pass them to the GetImage function.

You might find helpful our API reference: http://devnet.kentico.com/downloads/kenticocms_api.zip.

Hope the above description makes sense and suits your needs.

Best regards
Ondrej Vasil