in my web application i save users avatar with this method:
$avatarPath = request()->file('avatar')->store('avatars');
then i store $avatarPath in the database. to display the avatar on page i use:
<img class="doc-avatar" src="{{ Storage::disk('local')->url($doctor->image) }}" />
but as you guess there wont be any image and i don`t know why.
i created a symbolic link with:
php artisan storage:link
also checked the avatars folder in storage/app/public/avatars and my images are in there.
i can get all meta data about image with
Storage::url($doctor->image);
or
Storage::size($doctor->image);
but if i copy the returned URL in the browser there would be 404 error.
http://localhost:8080/storage/avatars/04it83vKYnobT7l8dNXwt1pE0VxiT9L5lQPQ6A1Z.jpeg
http://localhost/storage/avatars/04it83vKYnobT7l8dNXwt1pE0VxiT9L5lQPQ6A1Z.jpeg
both return 404.
and here is my config/filesystem.php
'default' => env('FILESYSTEM_DRIVER', 'public'),
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
<img class="doc-avatar" src="{{ asset(Storage::get($doctor->image)) }}" />- Prince Lionel N'zi