How do I save the google image map API picture to my server

前端 未结 4 2232
别跟我提以往
别跟我提以往 2020-12-14 04:23

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 loc

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-14 05:04

    This is really easy

    just use

    if(@copy('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', '/where-u-want-to-save/your-given-name.png')){
    echo "image-saved";
    }else{
    echo "failed"; }
    

    image always returns as png format you may give image a unique name by lat lng value or using php time() function

提交回复
热议问题