Particle Physics Images
http://photomatt.net
Inspired by Dan Benjamin > http://hiveware.com/imagerotator.php
Latest version always at:
http://photomatt.net/scripts/randomimage
*/
// Make this the relative path to the images, like "../img" or "random/images/".
// If the images are in the same directory, leave it blank.
$folder = '';
// Space seperated list of extensions, you probably won't have to change this.
$extsions = 'jpg jpeg png gif';
$i = -1; // Initialize some variables
if ('' == $folder) $folder = './';
$handle = opendir($folder);
$extsions = explode(' ', $extsions);
$file = readdir($handle);
while(false !== ($file = readdir($handle))) {
foreach($extsions as $ext) // for each extension check the extension
{
if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive
// it's good
++$i;
print("
");
$pos = strpos($file, '.');
$name = substr_replace($file, 'txt', $pos+1);
if( file_exists($name) ){
print("");
include($name);
print("");
}
print("
");
}
}
}
closedir($handle); // We're not using it anymore
?>