Laravel 5 - How to access image uploaded in storage within View?

前端 未结 12 2660
悲哀的现实
悲哀的现实 2020-11-22 14:05

I have got user\'s avatars uploaded in Laravel storage. How can I access them and render them in a view?

The server is pointing all requests to /public,

12条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 14:29

    First of all you need to create a symbolic link for the storage directory using the artisan command

    php artisan storage:link
    

    Then in any view you can access your image through url helper like this.

    url('storage/avatars/image.png');
    

提交回复
热议问题