Abd AM
Abd AM

Reputation: 119

How to store an image exists in resources directory in Laravel

For example: I have the resources directory where I stored my HTML files there. So this is the sentence I put to print the image, but couldn't reach it.

image source:

/resources/assets/images/Media/image.jpeg

So how to print the image if I'm now already in:

resources/view/form/index.blade.php

I tried this one :

<img src="/resources/assets/images/Media/default.png">

but it's not working,

Thanks and appreciate any suggestions through the solution :)

Upvotes: 2

Views: 2343

Answers (1)

Tibbelit
Tibbelit

Reputation: 1335

If you want to display the image on the website, store the image in the folder public, and it will be available. I.e.

public/images/Media/default.png

You can then use the asset()-function to generate the URL like:

$url = asset('images/Media/default.png');

https://laravel.com/docs/5.2/helpers#method-asset

Upvotes: 6

Related Questions