Skip to content
Advertisement

image not found when i include image in laravel blade file

I am really new to laravel. when i try to include a image inside my main.blade.php file at browser console i am getting image not found error.images are stored resources/img( i don’t know it’s the correct place also) folder.everything else in main.blade.php file working fine also.

this is the img tag inside main.blade.php

<img class="img-fluid rounded-circle p-5" src="../img/profile.png"" alt="" srcset="" />

So,can you tell me how am i suppose to include images in laravel. 🙂

Advertisement

Answer

you should include your resource files like images, CSS,js..etc files in public directory.to create a link to any resources like mention above use asset() function in laravel.

{{asset('img/profile.png')}}

for your img tag

<img class="img-fluid rounded-circle p-5" src="{{asset('img/profile.jpg')}}" alt="" srcset="" />
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement