我正在尝试将图像发布到我的前端页面,但是当我单击发布按钮时出现错误
图片来源不可读
private function handleRequest($request)
{
$data = $request->all();
if ($request->hasFile('image'))
{
$image = $request->file('image');
$fileName = $image->getClientOriginalName();
$destination = $this->uploadPath;
$successUploaded = $image->move(public_path('img'.$fileName));
//$successUploaded = $image->move($destination, $fileName);
if ($successUploaded)
{
$extension = $image->getClientOriginalExtension();
$thumbnail = str_replace(".{$extension}", "_thumb.{$extension}", $fileName);
Image::make($destination . '/' . $fileName)
->resize(250, 170)
->save($destination . '/' . $thumbnail);
}
$data['image'] = $fileName;
}
return $data;
}