How to get photo of place from google places api

Mark West picture Mark West · Jun 30, 2013 · Viewed 11.1k times · Source

I'm beginer to js and api

I have an for me big problem..

How to get photo for some places with google places api.

I try with this:

function setLink(i) {
            var photo = place.photos;
            var sideClick = jQuery("<a class=side_click href='#'></a>");
             $(sideClick).html(place.name+photo);
             $("#side_bar").append(sideClick).append("<br>");
             $(sideClick).on("click", function() {
               markers[i].modalWindow_.getDetails(markers[i].place_);
             });
          }

and I get only something like this:

Hotel Name [object Object]

How to change this [object Object] into url of image?

also i try with:

var photo = place.photos.geturl(); 

but also dont work...

How to solve this problem?

Answer

Dr.Molle picture Dr.Molle · Jun 30, 2013

place.photos is an Array , you must select an item of the array to get details for a particular photo

https://developers.google.com/maps/documentation/javascript/places#places_photos