'Images not showing up in laravel
So I have images working on my dev environment, however when i try to see them on the production server I receive a 404 error, the images are located in storage/app/public folder, I have ran the following command:
php artisan storage:link
The output says it works however it is still a 404 error when navigating to /storage/imagefolder/image on the site
Solution 1:[1]
Technically images are accessible through the public folder, not the storage folder.
In your Code you can access them like:
<img src="{{ asset('imagefolder/image') }}" />
You can find the correct/final image url with:
dd(asset('imagefolder/image'));
Solution 2:[2]
First delete the old symlink
Then from the command:
php artisan storage: link
And to display files: ?
<img src="{{ asset('imagefolder/fileName') }}" />
or
<img src="{{ /storage/imagefolder/fileName }}" />
Solution 3:[3]
File permission error on the existing link to storage from the public folder, deleting the link and re running the command fixed the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | NickSdot |
| Solution 2 | AlirezaAhmadi |
| Solution 3 | sgb999 |
