php 4 method , also no offence but I find kmas way too complex for such a simple thing
code:
<?php
error_reporting(E_ALL ^ E_NOTICE);
$folderdir = "./pics"; //EDIT THIS
$types = array('jpeg','.png','.bmp','.jpg','.gif');
//------ dont edit--------
$dir = array();
$folder=opendir($folderdir);
while ($file = readdir($folder)) $dir[] = $file;
closedir($folder);
$files = array();
for ($i=0;$dir[$i];$i++){
$ext=strtolower(substr($dir[$i],-4));
if (in_array($ext,$types)){
$files[]=$dir[$i];
}
}
$image = $files[rand(0,count($files)-1)];
$ext=strtolower(substr($image,-4));
$ext = str_replace('.','',$ext);
Header ("Content-type: image/$ext");
readfile($folderdir . '/' .$image);
?>