quote:
Originally posted by Methos2
??? im rubbish at php by the way, do you mean change
code:
$folderdir = "./images"; //EDIT THIS
$types = array('jpeg','.png','.bmp','.jpg','.gif');
to this...
code:
$folderdir = Header("Location: $imageurl");
$types = array('jpeg','.png','.bmp','.jpg','.gif');
???
nah i was refering to how the image is outputed
code:
<?php
error_reporting(E_ALL ^ E_NOTICE);
$folderdir = "./images"; //EDIT THIS
$types = array('jpeg','.png','.bmp','.jpg','.gif');
//------ dont edit--------
$dir = array();
$folder=opendir($folderdir);
while ($file = readdir($folder)) $dir[] = $file;
closedir($folder);
$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);
header("Location: " . $folderdir . "/" . $image);
?>