
May 26th, 2000, 06:22 PM
|
|
Junior Member
|
|
Join Date: May 2000
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I'm trying to create a php page to automatically display all images in a directory I specify, I want all the images to be thumbnailed on the fly, this is what I've come up with so far....
<?
$TheDirectory = dir($ImageDir);
while($Filename = $TheDirectory->read()) {
// Make sure we only show graphic files!
if ((strstr($Filename, '.jpg') <> False) | | (strstr($Filename, '.gif') <> False) | | (strstr($Filename, '.png') <> False)) {
// Get info about this image.
$ImageSize = GetImageSize($TheDirectory->path . $Filename);
// Create a thumbnail, try to keep the proportions correct
$ImageScale = $ImageSize[1] / $ImageSize[2];
$SourcePic = imagecreatefromjpeg ($TheDirectory->path . $Filename);
$DestPic = imagecreate(100, 100 * $ImageScale);
// Create a thumbnail from the image
imagecopyresized($DestPic, $SourcePic 0, 0, 0, 0, 100, 100 * $ImageScale, $ImageSize[1], $ImageSize[2]);
// Display the image
imagejpeg($SourcePic);
// Free up the resouces
imagedestroy($SourcePic);
imagedestroy($DestPic);
}
}
$TheDirectory->close();
?>
Ok, so $ImageDir is the directory name I send the page, and as you can see I've only set it up to handle jpg files atm.
So this isn't working, I just get a blank page what I need to know is...
- How do I find out what version of gd I'm using?
- Is there a way I can load a image, resize it then output it without using the gd functions? I would rather output the raw headers if possible but I'm not sure how, I'm not sure if my webhost is using the required version of gd, and I'd rather not have to hassle him for months to upgrade it.
- Does anyone know any examples of thumbnail gallerys I can download?
[This message has been edited by uTired2 (edited May 26, 2000).]
|