laravel-7

Broken Image in Laravel


I'm working in the Laravel web-app. My images are stored in "public/assets/dist/img"

What I'm using in my view is :

<img src="{{asset('dist/img/user1-128x128.jpg')}}" alt="User Avatar" class="img-size-50 mr-3 img-circle">

but when I try to execute my Laravel app using "php artisan serve" I see my images are broken, when I try to inspect and get image src that is: http://127.0.0.1:8000/dist/img/user1-128x128.jpg

It shows 404 | Not Found page.

I double checked that image with name "user1-128x128.jpg" exists in "public/assets/dist/img"

Why I'm not able to see the image? Is there something I'm missing?


Solution

  • It would be :

    {{ asset('/assets/dist/img/user1-128x128.jpg') }}
    

    assuming that your /assets/dist/img/user1-128x128.jpg is under /public/