Reputation: 4808
I am using Laravel 8
.
Trying to show image from storage/app/subject_image/
path but it doesn't display.
Below is my code on blade
<img src="{{asset("storage/subject_image/$data->subject_image")}}" alt="">
also i have inspected element on chrome its showing right path and right image name still its not showing. below is the inpsect element screenshot
Upvotes: 2
Views: 12341
Reputation: 139
The flowing 2 steps Work for me.
Step 1. Delete storage folder in public/storage
Directory then
Step 2. Run this command php artisan storage:link
Upvotes: 1
Reputation: 4808
Important Note
storage folder is not publicly accessible from the web browser and because of that we will have to create a symbolic link
what is symbolic link ?
you can say symbolic link as
alias
orpointer
to yourpath directory
Where you can configure symbolic links?
You may configure symbolic links in your
filesystems
configuration file that is located at path config/filesystems.php
Now lets configure symbolic link
suppose we have a image file located in storage/app/folder1/img.jpg
Now lets configure symbolic link for the above path -
Step 1: open config/filesystems.php
and configure custom symbolic link
public_path('my_custom_symlink_1') => storage_path('app/folder1'),
Step 2 : Now run Artisan command
php artisan storage:link
Just configuring symbol link in filesystems won't work , you will have to run php artisan storage:link
to create/active the symbolic link.
Step 3 : Now you can access you target file in browser using symbolic link
<img src="{{asset("my_custom_symlink_1/img.jpg")}}" >
Upvotes: 5