0

I am trying to map the below on Google static maps. however, the locations are not showing up when I use individual lat & log they work ... could you please help?

<img src = "https://maps.googleapis.com/maps/api/staticmap?&zoom=13&size=600x300&maptype=roadmap
&markers=color:blue%7Clabel:S%7C-21.1406555,149.1868439&markers=color:green%7Clabel:G%7C-23.8640118,151.2430725
&markers=color:red%7Clabel:C%7C-19.3205890,146.7620640
&key=AIzaSyAbiWesdtKxt-XXHaZRr56a5N_kCndduK0"/>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
shiv
  • 55
  • 1
  • 1
  • 5

2 Answers2

0

Follow this link Send google static map via email same like your question here by another user.Hope this will help.

Community
  • 1
  • 1
EArun
  • 43
  • 8
0

yes in using PHP and JavaScript you can pass static map URL and pass it through form submission and use in email

Get current location/ Coordinates through JavaScript

var latlon = position.coords.latitude + "," + position.coords.longitude;
var img_url = "https://maps.googleapis.com/maps/api/staticmap?center="+latlon+"&zoom=17&size=500x250&sensor=false&key=API_KEY&maptype=roadmap&markers=icon:http://maps.google.com/mapfiles/ms/icons/red-dot.png|"+latlon;
//here pass the value to input field
document.getElementById("map_image").value = img_url;

Inside form take input with id=map_image and type hidden than submit form and handle post request on next page

<input name="map_image" id="map_image" type="hidden" value=""/>

than for handling after submission of form

$map_image_url = $_POST['map_image'];

than you can use this as img in email template

G_real
  • 1,137
  • 1
  • 18
  • 28
Hassan Qasim
  • 463
  • 5
  • 5