Getimagesize Problem
Posted: Sat Jul 05, 2003 10:08 am
Hi everybody,
I just started with PHP and MySQL a couple of month ago, am making progress but still _so_ much to learn... Anyway, so now I am trying to build one of them fancy image galleries - you know - one of those where the user can click on a thumbnail on the "select" frame and the corresponding enlarged image would appear in the "details" frame. So far so good, works splendid and all - even with a MySQL database integrated and so forth. Now the only problem left is this: The images in the gallery have different proportions (3x4 and 4x3 respectively, depending on how my boss had turned his camera while taking them) and based on this the HTML of the detail frame should be different (e.g.: the small comments from the database should be on the bottom of the image for 3x4 images and on the right side for 4x3 images). I thought the easiest way to implement this would be read out the image proportions to build a small if loop of the kind:
if ($height > $width) { //some HTML}
else { //some othe HTML}
Now the only challenge I am unable to overcome is of how to convert the array that I get from getimagesize into variable ($width and $height respectively). Can anybody help me with this?
Regards,
Napper
I just started with PHP and MySQL a couple of month ago, am making progress but still _so_ much to learn... Anyway, so now I am trying to build one of them fancy image galleries - you know - one of those where the user can click on a thumbnail on the "select" frame and the corresponding enlarged image would appear in the "details" frame. So far so good, works splendid and all - even with a MySQL database integrated and so forth. Now the only problem left is this: The images in the gallery have different proportions (3x4 and 4x3 respectively, depending on how my boss had turned his camera while taking them) and based on this the HTML of the detail frame should be different (e.g.: the small comments from the database should be on the bottom of the image for 3x4 images and on the right side for 4x3 images). I thought the easiest way to implement this would be read out the image proportions to build a small if loop of the kind:
if ($height > $width) { //some HTML}
else { //some othe HTML}
Now the only challenge I am unable to overcome is of how to convert the array that I get from getimagesize into variable ($width and $height respectively). Can anybody help me with this?
Regards,
Napper