$files = array("img1.gif", "dragon.gif", "elfe.img", "prout.img", "mario.gif"); // put all the filenames of the images in this array
$cfile = $files[rand(0, count($files) - 1)];
$fp = fopen($cfile, "r");
$content = fread($fp, filesize($cfile));
fclose($fp);
header("Content-Type: image/gif\n");
echo $content;
Of course, if you add files with another extension that gif, you should change the content-type. If you use many extensions, you should write a couple of if statements...
What the script does it choosing a filename randomly, open it, printing its contents...