2

I saw that the json response from google places returns a field photo_reference. Does anyone know how to get the image associated?

  "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "320d77fa60610f618058bd58b8ba46e340c615b8",
         "name" : "The Meat & Wine Co",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 968,
               "html_attributions" : [],
               "photo_reference" : "CoQBeQAAAAgOdveT3dRtzoJ42BTBZfCdZptWsqLN3bROkP4FVHNNX-qjxBiw0vdGpDaX_lVb3rcaQf5hBVvrEdMUMDKB2gcsIOaVNII_zLvY-5Kf4rOuTXElOgSHb5vxJoB-o70Oh0Bs-zxxUpHM0Ji_BPk2RpXoKdf8jG_QLPaulXWoC7TcEhDSLjj-4_l3hJpD0W_qBtoMGhT1MK1GRVFH1dnJolimMP7Z8a2tZA",
               "width" : 1296
            }
         ],
         "rating" : 3.90,

3 Answers3

3

google also providing place photo api to retrieve photo from google map using photo_reference

https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=photo_reference&key=AddYourOwnKeyHere

key :- pass your application api key here.

maxwidth & maxheight :- the maximum desired height or width when it will returned by api

photoreference :- pass your photo reference here.

send request to this api. and it will return you image.

image type will be depend upon the type of the originally submitted photo.

for more info goto :- https://developers.google.com/places/documentation/photos

Aiyaz Parmar
  • 562
  • 6
  • 17
2

I've been wondering the same thing. I read about the Picasa API, that seems like a logical storage place for these images.

UPDATED 03-13-2013

This feature has been released as part of the Places API. See the link for documentation. https://developers.google.com/places/documentation/photos

Phil
  • 86
  • 5
0

Interpolate the photo_reference value in a HTML img tag

var photo_reference_goes_here = ['icon']['photos'][0]['photo_reference']

<img class="rig-img" src="https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=photo_reference_goes_here&key=GOOGLE_KEY" alt="Pic From Google">