Reputation: 533
I have followed the correctly marked answer in this question to save images in my app. I am having trouble displaying the images to blade file. I am using <img src="{{asset('/ProfileImages'.$p->profile_image)}}" alt="...">
ProfileImages is the storage folder with structure storage/app/ProfileImages. How do I display the images as the above line doesnot display?
Upvotes: 0
Views: 1113
Reputation: 6005
Laravel storage filesystem is so unique. When you doing any upload it will upload in the storage/app/public
directory. To make it accessible in public
directory, things need to do is create symlink by run command:
php artisan storage:link
Or
<img src="{{ Storage::url($p->profile_image) }} " alt=""/>
Upvotes: 1
Reputation: 91
By default when using {{asset()}}
this will look inside your Public directory you should either consider storing photos inside your Public directory
Or take a look at the documentation about Laravel File System, here they explain how you can use storage directory and link it with your public directory Laravel File System
Aslo you can use {{Storage::url()}} instead
Upvotes: 1
Reputation: 12401
use Storage::url()
<img src="{{ Storage::url($p->profile_image) }}" alt="...">
ref link https://laravel.com/docs/8.x/filesystem#file-urls
Upvotes: 1