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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get images in their original form as thumbnails?

Status
Not open for further replies.

vanbeugen

IS-IT--Management
Feb 4, 2005
62
0
0
NL
I would like to make a photo gallery with thumbnails which can be enlarged by clicking on a thumbnail. I made a first html on I use a table and thumbnails of photo's with height=80 and width=60 all fixed in the html code. But if an image is square or landscape I'll be in trouble.

This is my question: is there a way to get the thumbnails automatically in the correct form of original image? So if the image is landscape it shows a landscape thumbnail, of the image is portrait it shows a portrait thumbnail, if it is a square image it shows a square thumbnail.
 
Can\'t seem to get your link to work.

Seems the best way to get this information is to set up a DB to hold information about each photo. Then you can fetch it from server side or javascript&Ajax.

Thats what I do anyway.
 
Have you tried setting only the width or height instead of both?


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
You can read the image data from a database as rcp032 suggested or you could use code to detect their sizes as you load them.

If you detect the original image size it would just be a matter of calculating the thumbnail dimensions based on the original and your own settings for maximum height and width for wherever the thumbnails will display.

Check out faq216-5781 by BillRayPreachersSon on detecting image sizes client-side.


At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top