|
...
|
...
|
@@ -117,12 +117,13 @@ class ImageController |
|
|
|
return $hash;
|
|
|
|
}
|
|
|
|
$url = $this->path;
|
|
|
|
$res = $this->request->file('image')->move($url);
|
|
|
|
$fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
|
|
|
|
$res = $files->move($url,$fileName);
|
|
|
|
if ($res === false) {
|
|
|
|
return $this->response($files->getError(), Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
$data = [
|
|
|
|
'path' => $url.'/'.$res->getClientOriginalName(),
|
|
|
|
'path' => $url.'/'.$fileName,
|
|
|
|
'created_at' => date('Y-m-d H:i:s',time()),
|
|
|
|
'size' => $res->getSize(),
|
|
|
|
'hash' => $hash,
|
|
...
|
...
|
@@ -154,6 +155,7 @@ class ImageController |
|
|
|
* @return type
|
|
|
|
*/
|
|
|
|
private function multi($files) {
|
|
|
|
|
|
|
|
if (!is_array($files)) {
|
|
|
|
$files = [$files];
|
|
|
|
}
|
|
...
|
...
|
@@ -168,12 +170,13 @@ class ImageController |
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$url = $this->path;
|
|
|
|
$res = $file->move($url);
|
|
|
|
$fileName = uniqid().rand(10000,99999).'.'.$file->getClientOriginalExtension();
|
|
|
|
$res = $file->move($url,$fileName);
|
|
|
|
if ($res === false) {
|
|
|
|
return $this->response($file->getError(), Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
$save_data[] = [
|
|
|
|
'path' => $url.'/'.$file->getClientOriginalName(),
|
|
|
|
'path' => $url.'/'.$fileName,
|
|
|
|
'created_at' => date('Y-m-d H:i:s',time()),
|
|
|
|
'updated_at'=>date('Y-m-d H:i:s',time()),
|
|
|
|
'size' => $res->getSize(),
|
...
|
...
|
|