图片来源不可读 Laravel 5.3

image source not readable Laravel 5.3

我对 Laravel 的文章版本有疑虑。文章照片的版本无法正常工作。

我有以下错误:image source not readable

我是 Laravel 的新手,但我喜欢这样做,如果在编辑期间已经存在图像,他会保留原始照片:)

我的控制器:

public function update(Request $request, $id){
    $article = Article::find($id);
    $categorie = Categorie::find($article->idcategorie);
    if($article == null)
        return redirect("/home");
    $validation=[];
    $langues=Langue::all();
    foreach ($langues as $key => $value) {
        $validation["titrel".$value->id]='max:255';
    }
    $this->validate($request, $validation);
    DB::beginTransaction();
        try{
        $file=$request->file('upload');
        $path=storage_path('app/public/'.$categorie->libelle);
        if(!Filemgr::exists($path)) {
            Filemgr::makeDirectory($path.'/mini', 0766, true);
            Filemgr::makeDirectory($path.'/micro', 0766, true);
        }            
        Image::make($file)
            ->resize(1400, null, function ($constraint) {
                $constraint->aspectRatio();
            })
            ->save($path.'/'.$article->url);
        Image::make($file)
            ->resize(900, null, function ($constraint) {
            $constraint->aspectRatio();
            })
            ->save($path.'/mini/'.$article->url);
        Image::make($file)
            ->resize(600, null, function ($constraint) {
                $constraint->aspectRatio();
            })
            ->save($path.'/micro/'.$article->url);            
        foreach($langues as $key=>$value){
            $text=TextArticle::firstOrNew(['idlangue' => $value->id,'idarticle'=>$id]);
            $text->titre=$request->input('titrel'.$value->id);
            $text->save();
        }            
        DB::commit();
        }
        catch(Exception $e){
            DB::rollBack();                
        }
        $categorie=Categorie::find($article->idcategorie);
    return redirect("/categorie/".$categorie->libelle);
}

先谢谢你:)

使用这个:

if ($request->hasFile('upload')) {
//your code
}

应该有用:)