function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hylim1215hylim1215 

visualforce dynamically resize image

Hi, i have a VFP rendered as PDF and i would like to dynamically resize the image in my VFP if the image exceed 200px width. if the image width is below 200px, i do not want to stretch the image to 200px, keep it as it is. is that possible?

i tried to set Style = "width 50%" but it will stretch the smaller size image which doesnt look good.
Jay GuruswamyJay Guruswamy
Hi HyLim1215,

<apex:image id="theImage" value="{!$Resource.Image1}"  width="250" height="50" alt="Description of image here"/>

Best Regards,
Jay
 
hylim1215hylim1215
Hi Jay,

Thanks, but if my image's width is < 250 then it will stretch the image to fit the size which i dont want it, if the image is below the size, just keep as it is, only scale down the image if it exceed the size.

Thanks.
Jay GuruswamyJay Guruswamy
Hi, Below link will be helpful! https://developer.salesforce.com/forums/?id=906F0000000BaF6IAK Best Regards, Jay