<?php
/*
Copyright (C) 2004 Adam Smith
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or(at your option) any later version.
*/
$directory = "images/front/src";
$fd = opendir($directory);
$files = array();
$i = 0;
while (false !== ($file = readdir($fd))) {
if ($file != "." && $file != "..") {
$files[$i] = $file;
$i++;
}
}
$i = 0;
closedir($fd);
$file = array_rand($files);
preg_match("/\..*$/", $files[$file], $type);
if ($type = '.jpg' || $type = '.jpeg') {
$contenttype = 'image/jpeg';
} else if ($type = '.gif') {
$contenttype = 'image/gif';
}
header("Content-Type: $contenttype");
readfile($directory.'/'.$files[$file]);
?>