The thing is, my image is not directly present in my view
Route::Get('saakshar',function() { return view('version1'); });
and in my version1.blade.php
<?php include(app_path()."/../resources/views/fronthead.blade.php"); ?>
I know using php commands in blade file is not efficient or good in any manner, but blade command is not working, but that's not my main problem here.
and in my fronthead.blade.php
<img src='app_path()."/../resources/views/photos/logo.png"' alt="no logo">
I haven't learned fully the blade language, so for time being i am using php commands.
But my problem is, why isn't the photo loading in the webpage? Is the URL wrong? Did I place the "photos" folder in the wrong place?
Edit: I've even tried to place the photo is the same folder as fronthead.blade.php and changed the src tag.
I've even tried giving a separate Route::Get() from fronthead.blade.php, but still the problem persists.
Just put your Images in Public Directory (public/... folder or direct images). Public directory is by default rendered by laravel application.
You should store your images, css and JS files in a public
directory. To create a link to any of them, use asset()
helper:
<img src="{{ asset('img/myimage.png') }}" alt="description of myimage">
https://laravel.com/docs/5.1/helpers#method-asset
As alternative, you could use amazing Laravel Collective package for building forms and HTML elements, so your code will look like this:
{{ HTML::image('img/myimage.png', 'a picture') }}
If Image folder location is public/assets/img/default.jpg.
You can try in view
<img src="{{ URL::to('/assets/img/default.jpg') }}">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With