The Moerman Laboratory | |
About Dr. Moerman Ongoing Projects Selected Citations List of Muscle-affecting genes Muscle Images: 1 2 3 4 5 Protocols: Knockout / Poison Primer Worm SAGE datasets |
*
*08-NOV-2002: FOr gererating random number, the script now use mt_rand() instead of rand()...
* and the script check whether there is any file in the image directory before generating the
* random images... so if there is no image, it will print out an error message
*
*
*15-OCT-2002: Bug fix: On some server, "Warning: stat failed for (errno=2 - No such file or directory)"
*This have been fixed using @is_dir() instead of is_dir [Thanks to Ben Weinberger, Digitalsmith.com]
*
* First release in July 2002.
*/
function displayAaPHPrandomImage($dirname, $alt){
$dirhandle = opendir($dirname);
while (false !== ($file = readdir($dirhandle))) {
if ($file != "." && $file != ".." && !@is_dir($file) ) {
$filelist[] = $file;
}
}
closedir($dirhandle);
if(sizeof($filelist) ==0) {
echo "No file was found in the directory!";
exit;
}
srand((double)microtime()*1000000);
$picnum = @rand(0, sizeof($filelist) - 1);
$imageName=$dirname.$filelist[$picnum];
$imageSize = getimagesize($imageName);
if($imageSize[2]==4 || eregi(".swf$", $imageName) ) {
$result="\n";
} else $result="\n |