时间:2021-07-01 10:21:17 帮助过:31人阅读
这是自己做的解决办法,增加一个略缩图的子目录生成函数
步骤1>>
UploadFile.class.php中模仿getSubName()函数创建一个getThumbSubName()函数
代码如下:
private function getThumbSubName($file) {
switch($this->subType) {
case 'date':
$dir = date($this->dateFormat,time());
break;
case 'hash':
default:
$name = md5($this->thumbPath);
$dir = '';
for($i=0;$i<$this->hashLevel;$i++) {
$dir .= $name{$i}.'/';
}
break;
}
if(!is_dir(($this->thumbPath).$dir)) {
mkdir(($this->thumbPath).$dir);
}
return $dir;
}
步骤2>>
UploadFile.class.php中158行改为
代码如下:
$thumbPath = $this->thumbPath?$this->thumbPath.($this->autoSub?$this->getThumbSubName($file).'/':''):$file['savepath'];
最后问题解决!
http://www.bkjia.com/PHPjc/326109.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/326109.htmlTechArticle解决办法一(ThinkPHP官方提供的办法,我并没有测试过): 升级到ThinkPHP3.1最新的UploadFile.class.php(https://github.com/liu21st/extend/tree/master/Exte...