|
@@ -28,16 +28,15 @@ class UploadController extends Controller
|
|
$height = Image::make($filePath)->height();
|
|
$height = Image::make($filePath)->height();
|
|
//要保存的文件名 时间+扩展名
|
|
//要保存的文件名 时间+扩展名
|
|
$filename = time() . '_' . uniqid() . '.' . $kuoname;
|
|
$filename = time() . '_' . uniqid() . '.' . $kuoname;
|
|
- $fileurl = time() . '_' . uniqid() . '.' . $kuoname . '?' . $width . '_' . $height;
|
|
|
|
|
|
+ $fileurl = $filename . '?' . $width . '_' . $height;
|
|
} else {
|
|
} else {
|
|
//要保存的文件名 时间+扩展名
|
|
//要保存的文件名 时间+扩展名
|
|
$fileurl = $filename = time() . '_' . uniqid() . '.' . $kuoname;
|
|
$fileurl = $filename = time() . '_' . uniqid() . '.' . $kuoname;
|
|
}
|
|
}
|
|
$imageUrl = Storage::put($path . $filename, file_get_contents($filePath));
|
|
$imageUrl = Storage::put($path . $filename, file_get_contents($filePath));
|
|
- Log::debug('image_url:'.$imageUrl.'path:'.$path.$filename);
|
|
|
|
if ($imageUrl) {
|
|
if ($imageUrl) {
|
|
return [
|
|
return [
|
|
- 'data' => ['url' => $path . $filename]
|
|
|
|
|
|
+ 'data' => ['url' => $path . $fileurl]
|
|
];
|
|
];
|
|
} else {
|
|
} else {
|
|
return $this->response->error('图片上传失败,请重试', 500);
|
|
return $this->response->error('图片上传失败,请重试', 500);
|