I made some changes.... now it creates the image list automatically
PHP Code:
<?
$path = "/home/wherever/your/files/are/located/";
while($entryName = readdir($path)) {
if (preg_match("(.jpg|.gif|.jpeg|.png)",$entryName)) { // the the current file is an image
$images[] = $entryName; //get the file names
}
}
closedir($path);
$x = rand( 0, ( count( $images ) - 1 ) );
$tehfile = readfile( $path . $images[$x] );
header( "Content-type: image/jpeg" );
header( "Content-Disposition: inline; filename=" . $images[$x] );
return $tehfile;
?>