Home > database >  I can't return the image of a record located in the storage folder
I can't return the image of a record located in the storage folder

Time:12-28

I'm trying to display an image of a record in the table using storage, the code I made is not returning the image, and when I put its path in the browser it is possible to see the image.

  • Column to show image at table
<td> <img src="{{ url(\Illuminate\Support\Facades\Storage::disk('local')->url($cli->image_client)) }}" ></td>
  • Path from file
/opt/lampp/htdocs/client/storage/app/avatars/yTYkibyZFb9oYaF4uPfgHTg25Pa599PYiVI7btMC.jpg
  • filsystems.php
    'links' => [
        public_path('storage') => storage_path('app/public'),
        public_path('avatars') => storage_path('app/avatars'),
    ],
  • dd($validations['image_client'])
"avatars/yTYkibyZFb9oYaF4uPfgHTg25Pa599PYiVI7btMC.jpg" // app/Http/Controllers/ClientController.php:49

CodePudding user response:

To access the file in the avatars folder:

<img src="{{public_path($cli->image_client)}}" >

Or, from the storage directory:

<img src="{{storage_path("app/" . $cli->image_client)}}" >

CodePudding user response:

<td> <img src="{{ asset($cli->image_client) }}" height=100 width=100></td>
  • Related