使用用thinkphp,在生成缩略图时,缩略图放在跟原图同一个目录下时是不可以的
修改方法:找到UploadFile.class.php上传类
找到第161行,
if(false!==$image){
//图像文件生成缩略图
$thumbWidth=explode(',',$this->thumbMaxWidth);
$thumbHeight=explode(',',$this->thumbMaxHeight);
$thumbPrefix=explode(',',$this->thumbPrefix);
$thumbSuffix=explode(',',$this->thumbSuffix);
$thumbFile=explode(',',$this->thumbFile);
$thumbPath=$this->thumbPath?$this->thumbPath:$file['savepath'];
改成:
$file_savename=$file['savename'];
$sub_path='';
if($this->autoSub){
//使用子目录保存文件
$sub_path=$this->getSubName($file).'/';
$file_savename=str_replace($sub_path,'',$file_savename);
}
if(false!==$image){
//是图像文件生成缩略图
$thumbWidth=explode(',',$this->thumbMaxWidth);
$thumbHeight=explode(',',$this->thumbMaxHeight);
$thumbPrefix=explode(',',$this->thumbPrefix);
$thumbSuffix=explode(',',$this->thumbSuffix);
$thumbFile=explode(',',$this->thumbFile);
$thumbPath=$this->thumbPath?$this->thumbPath:$file['savepath'];
$thumbPath=$thumbPath.$sub_path;
这样就达到效果了