Display image saved in storage folder I uploaded an image on the storage folder.
On Controller:
$chesis_no = $request->input('chesis_no');
$filename = $request->owner_photo->getClientOriginalName();
$path = $request->owner_photo->storeAs('public/images/OwnerPhoto', $chesis_no.'_'.$filename);
$owner->owner_photo = $path;
The Image is saved on the storage folder as storage/app/public/images/OwnerPhoto/(imagename).
Path saved on database as public/images/OwnerPhoto/(imagename).
How do I retrive image on img src=" "
Did you link the storage dir to the public dir like the docs state? See about the "public disk" and how to set it up/use it with php artisan storage:link here: https://laravel.com/docs/5.8/filesystem
Then, the url would be /storage/images/OwnerPhoto/(imagename), or using the asset helper, asset('/storage/images/OwnerPhoto/imagename')
I am still having problem.
My storage path is public/images/OwnerPhoto/(imagename)
but I need path like /storage/images/OwnerPhoto/(imagename)
Tried php artisan storage:link
How are you retrieving the image?
Something like this
img src="/storage/images/OwnerPhoto/imagename"
But want to make it dynamic
Follow the documentation examples.
Use the asset helper.
Use asset helper. Wrap the path inside the asset helper like this src="asset('storage/...')"
Please sign in or create an account to participate in this conversation.