是否可以将谷歌地图图像API作为图像保存到我的服务器?
背景: Google地图图像API正在生成所需位置的图像.每次我要求外部URL.我可以将地图图像保存为服务器上的图像(png,gif)吗?这将提高我的网页速度.我尝试使用卷曲但未能复制图像
小智 15
你可以尝试这样的事情:
<?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);
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17889 次 |
| 最近记录: |