|
@@ -25,15 +25,16 @@ class UploadController extends Controller
|
|
$width = Image::make($filePath)->width();
|
|
$width = Image::make($filePath)->width();
|
|
$height = Image::make($filePath)->height();
|
|
$height = Image::make($filePath)->height();
|
|
//要保存的文件名 时间+扩展名
|
|
//要保存的文件名 时间+扩展名
|
|
- $filename = time() . '_' . uniqid() . '.' . $kuoname . '?' . $width . '_' . $height;
|
|
|
|
|
|
+ $filename = time() . '_' . uniqid() . '.' . $kuoname;
|
|
|
|
+ $fileurl = $filename . '?' . $width . '_' . $height;
|
|
} else {
|
|
} else {
|
|
//要保存的文件名 时间+扩展名
|
|
//要保存的文件名 时间+扩展名
|
|
- $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('upload_url:' . $imageUrl);
|
|
Log::debug('upload_url:' . $imageUrl);
|
|
if ($imageUrl) {
|
|
if ($imageUrl) {
|
|
- return $this->jsonSuccess(['url' => config('customer.chxq_oss_url') . $path . $filename]);
|
|
|
|
|
|
+ return $this->jsonSuccess(['url' => config('customer.chxq_oss_url') . $path . $fileurl]);
|
|
} else {
|
|
} else {
|
|
return $this->jsonError('图片上传失败,请重试');
|
|
return $this->jsonError('图片上传失败,请重试');
|
|
}
|
|
}
|
|
@@ -57,14 +58,15 @@ class UploadController extends Controller
|
|
$width = Image::make($filePath)->width();
|
|
$width = Image::make($filePath)->width();
|
|
$height = Image::make($filePath)->height();
|
|
$height = Image::make($filePath)->height();
|
|
//要保存的文件名 时间+扩展名
|
|
//要保存的文件名 时间+扩展名
|
|
- $filename = time() . '_' . uniqid() . '.' . $kuoname . '?' . $width . '_' . $height;
|
|
|
|
|
|
+ $filename = time() . '_' . uniqid() . '.' . $kuoname;
|
|
|
|
+ $fileurl = $filename . '?' . $width . '_' . $height;
|
|
} else {
|
|
} else {
|
|
//要保存的文件名 时间+扩展名
|
|
//要保存的文件名 时间+扩展名
|
|
- $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));
|
|
if ($imageUrl) {
|
|
if ($imageUrl) {
|
|
- array_push($urls, config('customer.chxq_oss_url') . $path . $filename);
|
|
|
|
|
|
+ array_push($urls, config('customer.chxq_oss_url') . $path . $fileurl);
|
|
} else {
|
|
} else {
|
|
Log::debug('文件上传失败。' . $filename);
|
|
Log::debug('文件上传失败。' . $filename);
|
|
}
|
|
}
|