php - Save and Show Google Maps image -
i have website (guidemanche.com) loads static maps images directly googlemaps. works fine if connected internet. if disconnected, or in case of site copy on cd, no more image. so, dl image created, store on server , display in page jpg file. doesn't work , have black image.
my code is:
<?php $url="http://maps.google.com/maps/api/staticmap?center=[(#latitude|scannav)],[(#longitude|scannav)]&zoom=14&size=450x400&maptype=hybrid&format=jpg&markers=color:blue|label:w|[(#latitude|scannav)],[(#longitude|scannav)]&sensor=false"; $filename="googleimg/#id_article.jpg"; if (!$handle = fopen($url, 'r')) { echo "impossible d'ouvrir le fichier ($filename)"; exit; } $contents = stream_get_contents($handle); fclose($handle); $handle2=fopen($filename, 'w'); // ecrivons quelque chose dans notre fichier. if (fwrite($handle2, $contents) == false) { echo "impossible d'écrire dans le fichier ($filename)"; exit; } fclose($handle2); ?>
where #id_article spip (cms) function.
how can parameter googlemaps code have image , back? thks
Comments
Post a Comment