Get image from storage folder in view - Laravel 5.4

I am trying to show the default.jpg image in my Laravel 5.4 profile.blade.php

.

  • I created a link between the shared folder and the folder store by using: php artisan storage:link

    .
  • The file is saved:

enter image description here

  • I am checking the source code of my web page which shows src="/public/storage/uploads/avatar/default.jpg"

But still no image was found. Can someone explain to me what I am missing?

+3


source to share


5 answers


remove public

from path and image will show if you set correct link



+4


source


You can use this in a view when there is a reference to the store:

<img src="{{ asset('storage/uploads/avatar/default.jpg') }}" alt="" />

      



This will create a complete resource URL for your image.

+4


source


Try the following:

     <img src="{{ asset('/storage/app/uploads/avatar/default.jpg') }}">

      

And, yours /storage/...../default.jpg

should be in the laravel public folder.

+2


source


remove post from path src="/public/storage/uploads/avatar/default.jpg"

0


source


You can get the file directly from the repository folder to create a symbolic link between the folder in the repository directory and the public folder.

ln -s path/to/public/storage/uploads/avatar/ /path/to/laravel/public/avatar

      

Then you should be able to get it right in the blade:

<img src="{{ asset('/avatar/default.jpg') }}">

      

0


source







All Articles