定義檔案:
\source\class\helper\helper_attach.php
方法定義:
public static function makethumbpath($id, $w, $h){
$dw = intval($w);
$dh = intval($h);
$_daid = sprintf("%09d", $id);
$dir1 = substr($_daid, 0, 3);
$dir2 = substr($_daid, 3, 2);
$dir3 = substr($_daid, 5, 2);
return $dir1.'/'.$dir2.'/'.$dir3.'/'.substr($_daid, -2).'_'.$dw.'_'.$dh.'.jpg';
}
參數說明:
$id:附件aid
$w:縮略圖寬度
$h:縮略圖高度
使用方法:
$path=helper_attach::makethumbpath($aid, $width,$height);
完整路徑:
'\data\attachment\image\'.$path;
縮略圖生成方法:
require_once libfile('class/image');
$img = new image;
$img->Thumb($filename, $path, $w, $h, $type);
其中$filename為改附件圖檔的原始路徑
$filename = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];