$dh = opendir(".");
while (false !== ($file = readdir($dh)))
if (preg_match('/\.gif$/i', $file) and $file != "avatar.gif")
$filelist = $file;
$picnum = rand(0, sizeof($filelist) - 1);
header("Location: " . $filelist[$picnum]);
Now you will need to upload .gif images to the selected directory that you have placed both avatar.gif and .htaccess, once you have done so, you can link to "avatar.gif" and your avatar will refresh whenever someone refreshes their browser.
AddType application/x-httpd-php .gif