我已经搜索过,并没有找到这个问题的答案。
好吧,我正在使用 laravel 5.5 的干预来上传照片。当我create
有一个新食谱(在我的情况下)时,一切正常,照片上传成功。
这是初始上传的代码:
$front_image = $request->file('front_image');
$frontImageName = md5(time()) . '.' . $front_image
->getClientOriginalExtension();
$locationfi = public_path('photos/front/' . $frontImageName);
Image::make($front_image)
->resize(454,340)
->insert(public_path('photos/logo.png'),'bottom-right')
->save($locationfi);
$recipe->front = $frontImageName;
所有标准的东西。但是当我尝试edit
一个食谱时,我得到了Image source not readable
。这是重新上传的代码:
$front_image = $request->file('front_image');
$frontImageName = md5(time()).'.'.$front_image
->getClientOriginalExtension();
$location = public_path('photos/front/'.$frontImageName );
Image::make($front_image)->resize(690,517)
->insert(public_path('photos/tk.png'),'bottom-right')
->save($location);
//update the database
$recipe->front=$imageName;
我enctype="multipart/form-data"
以两种形式使用,用于创建和更新。在更新表格上,我也使用{{method_field('PUT'}}
.
我在这里想念什么?谢谢。