Heres the one i coded myself for my avatar.
code:
<?php
$dir = "imgs";
$dh = opendir($dir);
$files = array();
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
array_splice($files, 0, 2);
$filesnum = count($files);
srand( (double) microtime()*1000000 );
$randnum = rand(0, $filesnum - 1);
readfile($dir . "/" . $files[$randnum]);
?>
It basically randomly pics a file from the imgs folder and uses that as the image.
Note: The file structure has to be
avatar.php
imgs/
and dont stick anyother files in the imgs folder, as it uses them all.