Laravel Thumbnail无法读取原始图像

时间:2016-09-09 14:53:19

标签: laravel-5 thumbnails

我正在尝试存储用户信息,包括Laravel 5.3中的图片。以下是相关代码:

if ( isset($request->image) )
            {$path = $request->file('image')->store('public/users');}

        $user = User::find($request->id);
        if (isset($path))
            {$user->image = $path;}
        $user->name = $request->name;
        $user->email = $request->email;
        $user->active = $request->active;
        $user->admin = $request->admin;
        $user->address = $request->address;
        $user->country_id = $request->country_id;
        if ($request->ageverified = 1)
            {$user->ageverified = 1;}
        if ($request->verifieddate <> '')
        {$user->verifieddate = $request->verifieddate;}
        $user->verify_notes = $request->verify_notes;
        $user->publisher = $request->publisher;
        $user->paypal = $request->paypal;
        $user->proname = $request->proname;

        if (isset($path)) {
            $file = Storage::url($path);
            $tpath = basename($path);
            Image::make($path)->resize(100,
                100)->save('public/users/thumbs/'.tpath);
            $user->thumbnail = $tpath;

        }

        $user->save();

图像存储正常但是当我开始制作缩略图时:

NotReadableException in AbstractDecoder.php line 302: Image source not readable

我已经尝试了一切,但我真的被卡住了!

1 个答案:

答案 0 :(得分:0)

我已经在laracast论坛中对此进行了整理 - 请参阅https://laracasts.com/discuss/channels/laravel/53-image-source-not-readable