2017-09-13 90 views
0

我已经搜索过,并且未找到对此问题的答案。干预图像源在更新上不可读

那么,我正在使用干预与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'}}

我在这里失踪了什么?谢谢。

+0

你正在使用哪个版本的php? –

+0

我使用的是PHP 7. @sunitiyadav – GabMic

回答

0

我已经解决了这个问题。他们说,“对于小事来说总是这样”。 当我插入徽标图像时,我提到一个不存在的phtoto。这就是为什么它显然给了我错误。