Question

I'm thinking about a possiblity for showing a users geolocation in an email. Would it be possible to generate a dynamic image with PHP which tracks the users geolocation and gives back an image.

Generating a dynamic image is no problem. But before I put too much effort in it, I try to find out if it's even possible or do I have to use a geo database instead?

While searching I came across HTML5 geo tracking: http://html5demos.com/geo

I wonder if I can use google maps API in order to generate my image.

Any suggestions/tips?

Thanks!

Was it helpful?

Solution

HTML5 geolocalization is probably not the best idea here, because it requires user to accept the tracking (and it can be not possible in some email clients other than web browsers or be simply blocked by them)

In this case it would be probably better to use some kind of GeoIP database and use Google Maps API to generate static image based on coordinates https://developers.google.com/maps/documentation/imageapis/

Note, that most email clients block external images by default.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top