最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to get photo of place from google places api - Stack Overflow

programmeradmin1浏览0评论

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?

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?

Share Improve this question asked Jun 30, 2013 at 13:30 Mark WestMark West 2672 gold badges5 silver badges17 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

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

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

发布评论

评论列表(0)

  1. 暂无评论