$mtime1) $changed=1; } elseif (!file_exists(DIR_CACHE.$thumb)) { $changed=1; } if ($changed) { $filename=$img; $new_width=(int)@$w; $new_height=(int)@$h; $lst=GetImageSize($filename); $image_width=$lst[0]; $image_height=$lst[1]; $image_format=$lst[2]; if ($image_format==1) { Header("Content-Type:image/gif"); readfile($filename); exit; } elseif ($image_format==2) { $old_image=imagecreatefromjpeg($filename); } elseif ($image_format==3) { $old_image=imagecreatefrompng($filename); } else { exit; } if (($new_width!=0) && ($new_width<$image_width)) { $image_height=(int)($image_height*($new_width/$image_width)); $image_width=$new_width; // $image_height=$new_height; } if (($new_height!=0) && ($new_height<$image_height)) { $image_width=(int)($image_width*($new_height/$image_height)); $image_height=$new_height; // $image_width=$new_width; } // $new_image=imageCreate($image_width, $image_height); // for old GDlib $new_image=imageCreateTrueColor($image_width, $image_height); $white = ImageColorAllocate($new_image, 255, 255, 255); ImageFill($new_image, 0, 0, $white); // imagecopyresampled // imageCopyResized (for old GDlib) imageCopyResampled( $new_image, $old_image, 0, 0, 0, 0, $image_width, $image_height, imageSX($old_image), imageSY($old_image)); imageJpeg($new_image, DIR_CACHE.$thumb); } Header("Content-type:image/jpeg"); readfile(DIR_CACHE.$thumb); exit; } // ---------------------------------------------------------------------- $init_dir="./"; if (IsSet($HTTP_GET_VARS['dir'])) { $dir=$HTTP_GET_VARS['dir']; $dir=preg_replace("/\.+/", ".", $dir); } if (IsSet($dir) && ($dir!=$init_dir)) { $directory=$dir; $tmp=array_reverse(explode('/', $dir)); array_shift($tmp); array_shift($tmp); $out['UP']=urlencode(implode('/', array_reverse($tmp))."/"); } else { $directory=$init_dir; } $dir=opendir($directory); $k=0; $on_row=IMAGES_ROW; if (file_exists($directory."files.txt")) { $data=LoadFile($directory."files.txt"); $lines=explode("\n", $data); for($i=0;$i$file, 'DIR'=>$directory, 'DESCRIPTION'=>$descriptions[$file], 'URL'=>urlencode($directory."$file/")); } if (!Is_file($directory."/$file")) continue; $ext=strtolower(substr($file, -3)); $valid_formats = array('jpg', 'png', 'PNG', 'gif', 'GIF', 'JPG', 'bmp', 'BMP'); // if ($ext!='gif' && $ext!='jpg') continue; if( in_array($ext, $valid_formats) ) { $rec=array(); $rec["FILENAME"]=$file; $size=(int)(filesize($directory."/".$file)/1024); if ($size>1024) { $rec["SIZE"]=(((int)($size*100/1024))/100)." Mb"; } else { $rec["SIZE"]=$size." Kb"; } if (IsSet($descriptions[$file])) { $rec['DESCRIPTION']=$descriptions[$file]; } $rec["DIR"]=$directory; if (($k+1)%$on_row==0) { $rec['NEXT_ROW']=1; } $k++; $files[]=$rec; } } //include('/home/folayele/public_html/images/template.php'); include('./template.php'); // ---------------------------------------------------------------------- function LoadFile($filename) { // loading file $f=fopen("$filename", "r"); $data=""; if ($f) { $data=fread($f, filesize($filename)); fclose($f); } return $data; } ?>