quote:
Originally posted by ipab
do you have GD and or GD2 libraries installed on your server?
thats not needed....
btw this uses a php5 only function "scandir" so if you dont have php5 ill post the changes for it to work with php4
code:
<?php
error_reporting(E_ALL ^ E_NOTICE);
$folderdir = "./pics"; //EDIT THIS
$types = array('jpeg','.png','.bmp','.jpg','.gif');
//------ dont edit--------
$dir = scandir($folderdir);
$files = array();
for ($i=0;$dir[$i];$i++){
$ext=strtolower(substr($dir[$i],-4));
if (in_array($ext,$types)){
$files[]=$dir[$i];
}
}
$image = $files[rand(0,count($files)-1)];
$ext=strtolower(substr($image,-4));
$ext = str_replace('.','',$ext);
Header ("Content-type: image/$ext");
readfile($folderdir . '/' .$image);
?>