images
| From: | Craig | Date: | Fri, 29 Nov 2002 11:37:00 +0000 |
| Subject: | images | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-126463@lists.php.net to get a copy of this message | ||
Not sure if this would be anyway possible, hopefull some of you GD gurus
will have an idea.
Basically the scenario is, I have a dirtectory of images(5 to be exact).
What I want to be able to do is something similar to the script below, which
randomizes a gif image selection. the file is called "image.php", the
person calls it like they would an image: <img src="img.php"> and boom there
ya have a nice gif image. But what I want to be able to do is join together
a number of images, so based on certain conditions, a user could call <img
src="img.php"> and this would show maybe two/three/four images joined
together. I can do this with one fine, but I thought there may be some sort
of GD function that would tackle this.
Thanks for any help,
Craig
<?php
Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0");
Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
Header("Pragma: no-cache");
Header("Content-Type: image/gif");
srand((double)microtime()*1000000);
$i = 0;
$dir = opendir("img");
while(($im = readdir($dir))) {
if($im != ".." && $im != "."){
$image[$i] = $im;
$i++;
}
}
closedir($dir);
$tot = count($image)-1;
$n = rand(0,$tot);
readfile("img/".$image[$n]);
?>