Josh Kirkpatrick
Josh Kirkpatrick

Reputation: 403

Laravel 5 Displaying image

I am trying to display an image stored in /resources/assets/img/champions/

with

     <img class="img-rounded"
           src="{{asset("/resources/assets/img/champions/Ahri.png")}}"
                style="width:32px;height:32px;">

Which gives me this output

<img class="img-rounded" 
src="http://localhost:8000/resources/assets/img/champions/Ahri.png" style="width:32px;height:32px;">

from what i know this should display the image right?

going to the path in the browser so

http://localhost:8000/resources/assets/img/champions/Ahri.png

gives me

NotFoundHttpException in compiled.php line 8140:

Upvotes: 2

Views: 7066

Answers (1)

ceejayoz
ceejayoz

Reputation: 179994

The Laravel 5 resources folder is not web accessible.

The asset() helper's URLs start from the public directory. Move resources/assets/img/champions/Ahri.png to public/resources/assets/img/champions/Ahri.png (or anywhere else in public) and it'll work.

Upvotes: 5

Related Questions