<?php
// RANDOM IMAGE SERVER by Sculptex
//
www.sculptex.co.uk
// Demo @ random.prevoo.uk
$path = "random/";
$files = array_diff(scandir($path), array('..', '.'));
$imgs = array();
$i = 0;
foreach($files as $file) {
$imgs[]= $file;
$i++;
}
$img = $imgs[rand(0,$i-1)];
$file_extension = strtolower(substr(strrchr($img,"."),1));
switch( $file_extension ) {
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg":
case "jpg": $ctype="image/jpeg"; break;
default:
}
header("Content-type: " . $ctype);
header("Expires: ". date("r",time() + (1)));
readfile($path.$img);
?>
Bookmarks