Is it possible to save the google map image API as an image to my server?
Background: Google map image API is generating an image of the desired location. Every time I am calling for the external URL. Can I save the map image as an image(png, gif) on my server? This will improve my web page speed. I tried with curl but failed to copy the image
Requested url http://maps.googleapis.com/maps/api/staticmap?center=15719+OAKLEAF+RUN+DRIVE%2CLITHIA%2CFL%2C33547%2CUS&zoom=8&size=150x100&markers=color:blue|label:S|11211&sensor=false
Street View imagery can only be used in digital advertisements where (1) the imagery comes directly from the Google Maps APIs or (2) the imagery is embedded or linked to on your website using HTML and URL provided on Google Maps.
you can try something like this:
<?php
$image = file_get_contents('http://maps.googleapis.com/maps/api/staticmap?center=15719%20OAKLEAF%20RUN%20DRIVE,LITHIA,FL,33547,US&zoom=8&size=150x100&markers=color%3ablue%7Clabel%3aS%7C11211&sensor=false');
$fp = fopen('ae.png', 'w+');
fputs($fp, $image);
fclose($fp);
unset($image);
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With