here is the original code
http://www.msfn.org/board/index.php?showtopic=47730
and here are some parts I don't understand
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');
OK, what does these part of header mean, and what does it do. is it reqired?
imagepng($image);
imagedestroy($image);
imagepng($image); means out put $image into PNG? does it works something like readfile() with out a need for a file?
imagedestroy($image); what does this used for and why should the image get destroyed here?
srand ((double) microtime() * 1000000);
$rnd = rand(1,4);
what's srand() doing here? there are a rand(1,4); after it so does srand do anything?
and how to make true random? I heard someone say that use rand() function does not give you true random....just to see if it's true...
Also showing off my work here...
<?php
$file[] = array("url"=>"php121logosm.gif",
"type"=>"gif");
$file[] = array("url"=>"phahaha.jpg",
"type"=>"jpg");
$rand = array_rand($file);
$url = $file[$rand]["url"];
$type = $file[$rand]["type"];
switch ($type) {
case "jpg":
header( "Content-Type: image/jpeg" );
break;
case "gif":
header( "Content-Type: image/gif" );
break;
case "png":
header( "Content-Type: image/png" );
break;
}
readfile($url)
?>
works great for me~ this is just version 0.02, there will be more function someday~