On my local machine project working file but when i uploaded on my server then all images are not shown, and NotFoundHttpException error when i hit full image path to browser.
mypath to project is as
/public_html/offlinemall/public
And Below is my filesystems.php
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
'featured' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
],
And how i get image
<img style="height: 480px" src="storage/{{ $ad->avatar }}">
In inspect i get full path but when i hit url then i get NotFoundHttpException error.
http://compare.theofflinemall.com/storage/featured_image/qzHWpQeSfKjZ6DOS59ROyYboJ1GCvVi6NNVfLtVV.jpeg
Your server can't locate storage
as path because it uses public_path
run
php artisan storage:link
It should work. Also, try to use
{{ asset('storage/'.$ad->avatar) }}