Laravel - how to get file path
In Laravel im using this code in my controller to get files from directory:
public function galleryImages($album) {
$images = File::allFiles('gallery/'.$album);
return View::make('galleryimages', ['images' => $images]);
}
and in my view "gallery":
@foreach($images as $image)
<img src="???"> <-- how to get file url here?
@endforeach
Now how can I get the pathName of the $ image variable? The Var_dump of the $ image is returned:
object(Symfony\Component\Finder\SplFileInfo)#247 (4) {
["relativePath":"Symfony\Component\Finder\SplFileInfo":private]=> string(0) ""
["relativePathname":"Symfony\Component\Finder\SplFileInfo":private]=> string(11) "garden5.jpg"
["pathName":"SplFileInfo":private]=> string(25) "gallery/Album/garden5.jpg"
["fileName":"SplFileInfo":private]=> string(11) "garden5.jpg" }
I tried to use $ image-> pathName but it doesn't work.
+3
source to share