php - Laravel image not shown on server and working fine on my local machine -
on local machine project working file when uploaded on server images not shown, , notfoundhttpexception error when hit full image path browser.
mypath project as
/public_html/offlinemall/public
and below 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 image
<img style="height: 480px" src="storage/{{ $ad->avatar }}">
in inspect full path when hit url notfoundhttpexception error.
http://compare.theofflinemall.com/storage/featured_image/qzhwpqesfkjz6dos59royyboj1gcvvi6nnvfltvv.jpeg
you can change image tag to:
<img src={{ asset('storage/'.$ad->avatar) }} />
<img src="storage/app/public/{{$ad->avatar) }}" />
<img src="<?php echo asset("storage/app/public/$ad->avatar")?>"></img>
Comments
Post a Comment