1

I'm using the JavaScript v3 API, and using this method to display place photos(using getUrl() function). Most photos are coming back fine, but some come back as an image with a minus sign, and when I check the browser console, I see those requests return 403 Forbidden. I don't think it is a usage issue(there are no issues in the google api console, and the issues are always on the same images for the same places). Could it just be an issue with the getUrl() function not finding the image? Anyone have any other ideas? Thanks!

Edit: Here's one that is showing a warning icon right now, and some code with that place id if anyone notices anything:

function placeDetailsCallback(place, status) {
    if (status == google.maps.places.PlacesServiceStatus.OK) {
        for (var i = 0; i < place.photos.length; i++) {
            htmlMarkup += '<img src="' + place.photos[i].getUrl({maxWidth:50, maxHeight:50}) + '" />';
        }
    }
}

var request = {
    placeId: result.place_id //retrieved from radar search, the specific id causing the 403s was "24f2649470d994428b3c95ffa421e4254d804cc8"
};
service.getDetails(request, placeDetailsCallback);  //service is google.maps.places.PlacesService

This is an example URL of a correct photo: https://lh4.googleusercontent.com/-H7Xz6z2_T0A/VNMJo0u9PvI/AAAAAAAAAA4/d9dZoeQOiEs/w50-h50-s0/photo.jpg

And one returning a warning icon: https://lh4.googleusercontent.com/-r27f8RAd6RE/UazyjOSj7JI/AAAAAAAAA-c/af3alOHZa98/w50-h50-s0/photo.jpg

Community
  • 1
  • 1
Evan
  • 836
  • 1
  • 13
  • 25
  • 1
    It would help if you showed actual code and inputs. They do sort of affect the results, and leaving them out leaves folks resorting to guesswork. – Peter Apr 24 '15 at 22:05
  • 1
    An example of a URL which works and a URL which fails would also be useful. – plexer Apr 24 '15 at 22:57
  • 1
    If the same code pulls out the rest of images & not the one in particular, It may be that Google does not permit users to show the photograph of that place in particular, It may be private. Can you please 1) send the API request of the place for which you are not getting photos 2) Actual code with getUrl(), getPhoto() functions!! – AniV Apr 25 '15 at 00:00
  • I have the same problem but I do not find the solution. For the moment I just do I loop while the correct image is not charged. I try to fix the problem! – SphynxTech Jul 28 '17 at 17:50
  • Same problem. If I copy the image url from the console into the browser, it shows up. And if I refresh my original application AFTER that, the image also shows up! So the image definitely exists and it's not a rate limit problem. It seems the url has to be accessed once before it can be used as an image src??? – morgler Aug 01 '20 at 15:40
  • Same problem. Morgler's hint that if you load it in a separate tab and then reload it from the application, it works... what kind of bug is this? – Ric Aug 05 '20 at 14:26

0 Answers0