Lumen : How to display the image on a public folder?
image, laravel, lumen, php
Solution
You can do like the below.
asset('uploads/images/product/' . $product->image)
or
asset('uploads/images/product/') . '/' . $product->image
Problem
I want to display the image that stored in public folder on Lumen project. But I got 404 not found when try to display it in browser. I already create the asset url helper: ``` if (!function_exists('urlGenerator')) { /** * @return \Laravel\Lumen\Routing\UrlGenerator */ function urlGenerator() { return new \Laravel\Lumen\Routing\UrlGenerator(app()); } } if (!function_exists('asset')) { /** * @param $path * @param bool $secured * * @return string */ function asset($path, $secured = false) { return urlGenerator()->asset($path, $secured); } } ``` and this is how I call the image URL : ``` asset('public/uploads/images/product/') . $product->image ``` why lumen referring to route when I try to call image in public folder ?