Thread: help
View Single Post
  #9  
Old 05-31-2005, 10:33 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,924

Heres my version..
PHP Code:
<?
$files_array
=array("jpg","gif","png");
$path="./img/logo/";


function 
get_ext($key) { 
    
$key=strtolower(substr(strrchr($key"."), 1));
    return(
str_replace("jpeg""jpg"$key)); 
}



$dir=opendir($path);
while (
false !== ($file readdir($dir))) {

    If((
$file!=".") AND ($file!="..") AND (!is_dir($file)) AND (in_array(get_ext($file),$files_array))) {
        
$files[]=$file;
    }

}

closedir($dir);
shuffle($files);
$sig=$files[0];
$size=getimagesize($path.$sig);

If(
$size) {

    
$fp=fopen($path.$sig"rb");

    If(
$fp) {
        
header("Content-type: ".$size['mime']);
        
fpassthru($fp);
        
fclose($fp);
        exit;
    }
}
?>
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote