I would like to cache images in Laravel. All the solution I could find where for images I am serving myself but the images are coming from a google places api call. From the place details api call.
So what I would like to do if a user requests the images for a certain location that using my webapp, I would like to cache the images that are retrieved as a result.
The google places details api call retrieves the hash for the image and I can construct the url for the image like this:
$photos[] = 'https://maps.googleapis.com/maps/api/place/photo?photoreference=' .
$photo->photo_reference .
'&sensor=false&maxheight=400&maxwidth=400&key=' .
$apiKey;
The image is then retrieved and shown in the front end.
We are using the Laravel way by doing something like Cache::get($id.'photos')
but this only caches the url and that isn't very helpful.
We also found the following link https://github.com/Intervention/imagecache but this repo is quite old and we are using Laravel 5.7 so the techniques employed in this repo are no longer applicable.
Any suggestions would be greatly apreciated!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire