而且是指定圖片 其他圖片好好的
/**
* 上傳圖片
* @param Request $request
* @return Response
* @throws Exception
*/
public function image(Request $request): Response
{
$data = $this->base($request, '/upload/img/'.date('Ymd'));
$realpath = $data['realpath'];
try {
$img = Image::make($realpath);
$max_height = 1170;
$max_width = 1170;
$width = $img->width();
$height = $img->height();
$ratio = 1;
if ($height > $max_height || $width > $max_width) {
$ratio = $width > $height ? $max_width / $width : $max_height / $height;
}
$img->resize($width*$ratio, $height*$ratio)->save($realpath);
} catch (Exception $e) {
unlink($realpath);
return json( [
'code' => 500,
'msg' => '處理圖片發(fā)生錯(cuò)誤'
]);
}
return json( [
'code' => 0,
'msg' => '上傳成功',
'data' => [
'url' => $data['url'],
'name' => $data['name'],
'size' => $data['size'],
]
]);
}
只有指定圖片才會出現(xiàn)這種問題 而且這張圖片也不能上傳到這里