1

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" >
4
  • 2
    Inspect the image using browser debugger and check what is path there? Commented Feb 16, 2017 at 10:35
  • may be path missing check it out once...and follow the comment of @ParthVora Commented Feb 16, 2017 at 10:37
  • Use public_path() to get path upto public Commented Feb 16, 2017 at 10:41
  • anyone on this solution? Commented Jul 13, 2018 at 12:12

4 Answers 4

2

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.

Sign up to request clarification or add additional context in comments.

Comments

2

Try this:

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

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

Comments

2

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

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

Comments

0

Check this one

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.