Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Images - Maintain height width ratio

Status
Not open for further replies.

esearing

IS-IT--Management
Aug 22, 2000
132
US
How do I maintain the height and width ratio in a thumbnail image when I have multiple images with differing ratios (some tall_and_skinny, some short_and_Fat).

I am calling the image name from a database and outputing it on a new page as a thumbnail.

<img src=&quot;ImageName&quot; height=&quot;150&quot; width=&quot;150&quot;>
does not work because it distorts the image.

PS I do not want to create two versions of the image since I will be managing thousands of images.

Eric Searing
eric.searing@wcom.com
 
The most practical way I can see to do this is to create another field in your image table that holds the height/width ratio value. Your script can then take that and calculate the appropriate size parameters for the image.

You could try to find a COM component that can open the image and extract the properties. Someone somewhere probably has encountered your problem and solved it that way.

Making thumbnails yourself in Photoshop is the preferd way to handle your situation since having the browser resize the images causes some loss of quality.
 
Does anyone know how do you obtain the size of the image with out opening the image. Can you just get the width and height of the image using something like FileSystemObject?

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top