
// -------------------------------------------------------------------
// PHP Random Image Script
// PHP-Princess.net
// This script is Link-ware ;) If you want to use it, please link
// to php-princess.net
// -------------------------------------------------------------------
// File created: 01.24.2003
// Author: Daynah
// Email: me@daynah.net
// -------------------------------------------------------------------
// Function to get array of all images in directory
function listdir()
{
$ImgArray = array(); // Image Array
// File handle variable to open current directory
$handle = opendir('./albums/thumbs/');
// Loops through the directory
while ($file = readdir($handle))
{
$imgfile = substr($file, -3);
if(($imgfile == 'gif') || ($imgfile == 'jpg') || ($imgfile == 'png') )
{
$ImgArray[] = $file;
}
}
return $ImgArray;
}
// Calculate which image to display
$ImgArray = listdir();
$imgCount = count($ImgArray) - 1;
$randomnum = rand(0, $imgCount);
// You may edit this line to change the image display
echo ' ';
?>
|