Upload a Picture in an Infowindow and store/retrieve it via javascript->PHP->MySQL

661 views
Skip to first unread message

aknorbert

unread,
Dec 19, 2011, 12:26:51 PM12/19/11
to Google Maps JavaScript API v3
Hey,
I am kind of new to Google Maps API v3 coding. I have the following
issue:
I would like to create an infowindow with the possibility to upload a
picture to that position, sth. like a HTML-Form in an infowindow.
If a user saves it and closes the infowindow the next time the user
logs in and e.g. clicks on the marker connected to that infowindow,
e.g. his picture will show up in the infowindow, again. I have only
seen sth. similar in the Google Tutorial, but not with a picture, only
with something like:

downloadURL("somePHP.php?lat" + "&lat"...), to store or to call data.
But how does it work with pictures.

Maybe someone has a good tutorial for that problem. Maybe someone is
able to do this with creating user specific KML-files, so if a user
logs in, and wants to add some private information to a place, and
upload a picture to it, a KML-file is created and sent to my SQL-
Database.

Please help, Google Maps Coding is fun. And please only answer if
suggestion really helps and is constructive. Thank you,

Aknorbert

Rossko

unread,
Dec 19, 2011, 3:21:00 PM12/19/11
to Google Maps JavaScript API v3
> I have only
> seen sth. similar in the Google Tutorial, but not with a picture, only
> with something like:
>
> downloadURL("somePHP.php?lat" + "&lat"...), to store or to call data.
> But how does it work with pictures.

It's not really a maps question. If you wanted to show an image on a
webpage, you'd use the <img> tag and pass a url to the image. It is
just the same if you want to show an image in an infowindow - you
include an <img> tag pointing to the url of the desired image.

So your server side code needs to be able to store user-supplied
images somewhere, and when required supply a url to the desired
image. This is normal AJAX/DHTML activity and not specific to maps -
look further afield

Seis Pesos

unread,
Dec 19, 2011, 7:26:06 PM12/19/11
to Google Maps JavaScript API v3
demo:
http://japonyol.net/google-photo-map.php

it is not use database but xml file (php5 required).
method is same.

Satpack Travel

unread,
Dec 20, 2011, 2:13:30 AM12/20/11
to Google Maps JavaScript API v3
Hi.

I also struggled with this and was also new to Maps until recently.
But (with the help of others, including on this and the Fusion Table
Forum) we managed to get pretty much what you're asking for done:

http://www.mukaranga.com/the-twig.html

The difference to my understanding of what you need is that you want
the info to be private (ours is all public), a) because we want it to
be and b) I think to be able to read/write to Fusion Tables then all
info needs to be able to be viewed (but not listed or editable) to the
public.

Hope is of some use...

Rob

Bob Torzynski

unread,
Dec 20, 2011, 5:48:49 AM12/20/11
to Google Maps JavaScript API v3
Hi, that's a great maps-related question IMHO. I have an app here:
http://osm.zgroks.com/gosm.html that allows users to create markers
and infowindows and has lots of other functionality. It DOES use
Google Maps API v3 Javascript, PHP, and SQL based on the combined
tutorials and extreme hack #63 from the book Google Maps Hacks. But I
haven't figured out the photo upload part either. Based on the
response that uploads to XML that was offered to your question, I
think it should be fairly easy to incorporate that code into my app
and once I have done so I will share. I am also new to Google Maps
Javascript API v3 coding as well and really appreciate all the kind
and useful responses on this list. -Bob
Reply all
Reply to author
Forward
0 new messages