hehe

thanks
I've made it a lil bit shorter
don't forget to close the directory handle in your code btw...
Code:
<?php
$handle = opendir (getcwd ()) or die ();
$files = Array ();
$file_count = 0;
// loop through all the files in the directory
while (($file = readdir ($handle)) !== false)
{
if (is_dir ($file))
continue; // discard directories
$ext = strstr ($file, "."); // get the file extension
// is this file of one of the allowed extensions ?
if ((strcasecmp ($ext, ".png") == 0)
|| (strcasecmp ($ext, ".jpeg") == 0)
|| (strcasecmp ($ext, ".gif") == 0))
{
$files[$file_count] = $file; // yes it is, add the file to the array
$file_count++; // we know now one image more
}
}
closedir ($handle); // finished, don't forget to close directory handle
// did we find no image ?
if ($file_count == 0)
return; // if so, don't output anything at all.
// output a random image file among those in the array
readfile ($files[rand (0, $file_count - 1)]);
?>