function writeRandomImage()
{
$path = "/ws1b/dd/www.nhmast.us/htdocs/images/random";
$url = "/images/random";
global $usedImages;
if(!isset($usedImages))
{
$usedImages = array();
}
if ($handle = opendir($path))
{
# Build a list of all the image files in the directory
$files = array();
while (false !== ($file = readdir($handle)))
{
if (substr($file, -4) == ".jpg" || substr($file, -4) == ".gif" ||
substr($file, -4) == ".png" || substr($file, -4) == ".bmp" ||
substr($file, -4) == ".tif")
{
array_push($files, $file);
}
}
}
# Get a random filename (make sure it isnt the same as one already used)
$idx = rand(0, count($files) - 1);
while (count($usedImages) < count($files) && in_array($files[$idx], $usedImages))
{
$idx = rand(0, count($files) - 1);
}
# Display the image
echo " \n";
array_push($usedImages, $files[$idx]);
}
writeRandomImage();
?>
writeRandomImage();
?>
writeRandomImage();
?>
|
Organizations
|
In the News...
"Schools Slow In Closing Gaps Between Races"
"Are Boys Really in Trouble?"
“Study Reveals Dropout Risks ” Report: Bright Students Should Skip Grades
“Long Breaks Lower Likelihood of Finishing College, Study Says”
Are Parents and Students Ready for More Math and Science?
Find It Fast
NH Organizations
Professional Development Centers
Museums & Informal Education Centers
|