Katrin_cage
Katrin_cage

Reputation: 11

Laravel, not displayed image from public folder

I have problem with displaing images from public directory:

<img src="{{asset('public/front/images')}}/index/logo.jpg">

Image looks like this. enter image description here

from another folders images are displaed correctly

<img src="{{url('/')}}/images/banner1.jpg" >

Upvotes: 1

Views: 13113

Answers (4)

jenish lila
jenish lila

Reputation: 151

Try to use this, If your image is in public folder

<img src="{{url('images/banner1.jpg')}}" >

Upvotes: 2

Rupali Pemare
Rupali Pemare

Reputation: 540

Check this one

<html>
<body>
  <img src="{{ URL::asset('/front/images/index/logo.jpg') }}" />
</body>
</html>

Upvotes: 0

Parth Vora
Parth Vora

Reputation: 4114

Try this:

<img src="{{ asset('front/images/index/logo.jpg'); }}">

You don't need to use public prefix with asset().

Upvotes: 2

ukalpa
ukalpa

Reputation: 329

Laravel has some rewrite rules to rewrite you url path. The static files may not be accessed due to following reasons: 1. Check the permission of your folders, "chmod -R 777 folder" in Linux or authenticate the permission to anyone for the folder in Windows, then try again. 2. Check the web server configure if it restrcits the folder to be accessed. 3. Check your route if there is any route/resource/route::group has the same name with the folder.

By the way, you can put your static files in another folder which is out of the base_path() in Laravel, then set a alias in the web server to let it be accessed. In case, this method makes the structure more clear.

Upvotes: 2

Related Questions