skip to Main Content

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(IlluminateSupportFacadesStorage::disk('local')->url($cli->image_client)) }}" class="w-16 h-auto"></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

2

Answers


  1. Chosen as BEST ANSWER
    <td> <img src="{{ asset($cli->image_client) }}" height=100 width=100></td>
    

  2. To access the file in the avatars folder:

    <img src="{{public_path($cli->image_client)}}" class="w-16 h-auto">
    

    Or, from the storage directory:

    <img src="{{storage_path("app/" . $cli->image_client)}}" class="w-16 h-auto">
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search