Anamol  Shrestha
Anamol Shrestha

Reputation: 65

How to display image that is stored in public folder whose path is working fine?

I'm trying to display the image that is stored in my public folder. The path to my image is being displayed when i just use {{$post-> image}} but i cant get the image to be displayed when i run the following command.

@foreach($posts -> $post)
      <tr>
                <td> <img src="{{ asset($post->image) }}" alt=""></td>
                <td> {{ $post-> title }} </td>
      </tr>
@endforeach

chrome screenshot folder screenshot

Upvotes: 2

Views: 276

Answers (1)

Jovs
Jovs

Reputation: 892

Base on your picture the only path you're calling is public/posts/picture.jpg but also based on your picture you need to call public/storage/posts/picture.jpg so you need

{{asset('storage/posts/picture.jpg')}}

Upvotes: 1

Related Questions