|
-------------------------------------------------------------
*/
$dir=opendir("/www/images/");
//This is the directory route to the folder
$directory="";
//This is a relative link to the directory if it is not in the same directory as the file you are displaying the images on
$pattern="\.(gif|jpg|jpeg|png|bmp|swf)$";
if(!$dir)
{
die("Failed to read directory");
}
$s=readdir($dir);
$count="0";
$image;
while($s)
{
if(ereg($pattern, $s))
{
$image[$count]=$s;
$count++;
}
$s=readdir($dir);
}
closedir($dir);
//Spit it out
$limit=count($image);
$limit--;
$randNum=rand(0,$limit);
$size=getimagesize("$directory$image[$randNum]");
echo "
";
?>