|
...
|
...
|
@@ -121,17 +121,16 @@ class ImageController extends Controller |
|
|
|
]);
|
|
|
|
$files = $this->request->file('image');
|
|
|
|
$size = $files->getSize();
|
|
|
|
var_dump($size);
|
|
|
|
die();
|
|
|
|
$image_type = $files->getClientOriginalExtension();
|
|
|
|
if (empty($files)) {
|
|
|
|
$this->response('没有上传的文件!', 400);
|
|
|
|
}
|
|
|
|
$type = $this->request->post('type','single');
|
|
|
|
$this->setUrl();
|
|
|
|
if ($type == 'multi') {
|
|
|
|
return $this->multi($files);
|
|
|
|
return $this->multi($files,$size,$image_type);
|
|
|
|
}else{
|
|
|
|
return $this->single($files);
|
|
|
|
return $this->single($files,$size,$image_type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -143,7 +142,7 @@ class ImageController extends Controller |
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/17 16:30
|
|
|
|
*/
|
|
|
|
public function single($files){
|
|
|
|
public function single($files,$size,$image_type){
|
|
|
|
$hash = hash_file('md5', $files->getPathname());
|
|
|
|
//查看文件是否存在
|
|
|
|
$imageModel = new ImageModel();
|
|
...
|
...
|
@@ -159,8 +158,6 @@ class ImageController extends Controller |
|
|
|
$cosService->uploadFile($files,$this->path,$fileName);
|
|
|
|
}else{
|
|
|
|
$res = $files->move($url,$fileName);
|
|
|
|
$size = $res->getSize();
|
|
|
|
$image_type = $files->getClientOriginalExtension();
|
|
|
|
if ($res === false) {
|
|
|
|
return $this->response($files->getError(), Code::USER_ERROR);
|
|
|
|
}
|
...
|
...
|
|