Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access images inside public folder in laravel

Tags:

laravel

How can I access the images stored inside public/images folder without the use of Laravel's own functions like assets()?

I just want to get the direct URL of the images stored in images folder.

Eg:

localhost/webapp/images/stackoverflow.png 

When requesting the link i should get the direct image.

like image 723
PaladiN Avatar asked Oct 09 '14 19:10

PaladiN


People also ask

How do I show public images in laravel?

Just put your Images in Public Directory (public/... folder or direct images). Public directory is by default rendered by laravel application. Let's suppose I stored images in public/images/myimage.

Where to store images in laravel?

I need it to store only the filename of the image and extension, as I'm saving it to the laravel app/storage/uploads folder. response from the form. use App\Person; use Image; the file will be moved inside the storage folder under the uploads folder .


2 Answers

Just put your Images in Public Directory (public/...folder or direct images).
Public directory is by default rendered by laravel application.
Let's suppose I stored images in public/images/myimage.jpg.
Then in your HTML view, page like: (image.blade.php)

<img src="{{url('/images/myimage.jpg')}}" alt="Image"/> 
like image 45
Dadu Laal Avatar answered Oct 04 '22 14:10

Dadu Laal


If you are inside a blade template

{{ URL::to('/') }}/images/stackoverflow.png

like image 158
Colin Schoen Avatar answered Oct 04 '22 15:10

Colin Schoen