Bleeeeeeeeeee *whaps Truly*
Announcement
Collapse
No announcement yet.
testing dynamic sig.
Collapse
X
-
testing dynamic sig.
I have a series of images in a folder named 1.png, 2.png, 3.png and so on along with an index.php file that has the following:
$dir = ".";
$handle = opendir($dir);
$count = 0;
while (false !== ($file = readdir($handle))) {
if (is_file($file) && $file !== '.' && $file !== '..') {
$count++;
}
}
$seed = round(rand(1,$count-1),1);
$im = imagecreatefrompng($seed.".png");
///////////////////////////////////
header("Content-type: image/jpeg");
imagejpeg($im);
I'm sure there's a better way to do this, but I was just throwing something together.
Comment
-
testing dynamic sig.
Ah, the way I'm doing it is this:
<?
$sig1 = "./lmz/sigs/1.png";
$sig2 = "./lmz/sigs/2.png";
$sig3 = "./lmz/sigs/3.png";
$sig4 = "./lmz/sigs/4.png";
$sig5 = "./lmz/sigs/5.png";
$sig6 = "./lmz/sigs/6.png";
$sig7 = "./lmz/sigs/7.png";
$sig8 = "./lmz/sigs/8.png";
$randomnumber = rand(1,8);
$sigrandom = "sig$randomnumber";
$sigimage = ${$sigrandom};
// spit out the headers, then the image
$opensig = fopen($sigimage, 'rb');
header("Content-Type: image/png");
header("Content-Length: ".filesize($sigimage));
header("Pragma: no-cache");
fpassthru($opensig);
exit;
?>
Seems to work well, and doesn't require the images to be in the same directory. Of course, the actual script I'm using does a couple more odd things....
Comment
-
testing dynamic sig.
hmm.. actually, it would be easier for me to use the readfile function than having it create an image.
I changed it to:
$dir = ".";
$handle = opendir($dir);
$count = 0;
while (false !== ($file = readdir($handle))) {
if (is_file($file) && $file !== '.' && $file !== '..') {
$count++;
}
}
$seed = round(rand(1,$count-1),1);
header("Content-type: image/jpeg");
readfile($seed.".png");
Comment
Comment