View Full Version : Php photo album that figures out pic dimensions

07-10-2005, 06:28 AM
Is there any to make in php / mysql, an online photo album, that I can just upload to a certain directory, a batch full of .jpg photos, but the photos are in different dimension sizes, for the purpose of displaying on a online photo album? (I can figure out making an online photo album with pagination, but I had to enter in the db all the pics, and their sizes, etc....which I dont want to do)

e.g. If I have scanned a whole box full of old family photos, and some are in landscape format, some in portriat format, some larger or smaller than others....any way to just upload them, and have php figure out what dimensions they are? (I'm trying to avoid batch resizing and rotating, etc.)

Any help on direction with this issue would be appreciated.


Len Whistler
07-10-2005, 07:19 AM
$size = getimagesize($filename);

$size[0] and $size[1] will be the height and width (or width and height) of the image, so you don't have to enter that info into a database, php will do it for you. I think $size[3] might be both height and width.

As far as rotating images you will have to do that yourself, no program can tell if it should be landscape or portrait. But some cameras can rotate in camera using a sensor that knows the angle of the camera.