Laravel: 无法从本地/app 获取图像

Laravel: cant get image from local /app

我可以上传图片并在storage/app/(abc.jpg)

中查看图片

并设置 'root' => storage_path('app'), 在 filesystems.php

account.blade.php

<img src="{{ route('account.image', ['filename' => $user->user_id . '.jpg']) }}" alt="" class="img-responsive">

routes.php

Route::get('/userimage/{filename}', [
        'uses' => 'UserController@getUserImage',
        'as' => 'account.image'
        ]);

控制器

public function getUserImage()
    {
        $file = Storage::disk('local')->get($filename);
        return new Response($file, 200);
    }

GET http://localhost:8000/userimage/00bea23ff9dd07e5b175c0f8a9283ca8.jpg 500 (Internal Server Error)

在您的控制器方法中,您需要像这样定义 $filename...

public function getUserImage($filename)