Browse Source

图片上传优化

master
wanghongjun 4 months ago
parent
commit
62e75da0b5
  1. 5
      app/common/controller/Upload.php

5
app/common/controller/Upload.php

@ -84,7 +84,7 @@ class Upload extends BaseController
$prefix=$filecate.'/'.date('Y-m-d').'/'.$uid."/";
}
$name=str_replace('.'.$info['ext'],'',$info['name']);
$file=FileModel::where(['md5'=>$info['md5']])->find();
$file=false;//FileModel::where(['md5'=>$info['md5']])->find();
// 判断文件是否存在,如果有则不再上传
if(!$file){
$newName = uniqid() . '.' . $info['ext'];
@ -447,6 +447,9 @@ class Upload extends BaseController
// 原图地址
$filePath = root_path().'public' . $src;
if (!file_exists($filePath)) {
return '';
}
// 处理图地址
$target = root_path().'public/' .ltrim($compress_path,'/');
// 图片模糊处理

Loading…
Cancel
Save