javascript - Processing google photo reference to get the image url -
i ham using node.js , have photo reference string , want access image returned.
i have following code , getting in body.
locations.foreach(function(loc) { var photoref; if (loc.photos && array.isarray(loc.photos)) { photoref = loc.photos[0].photo_reference; var url_in = 'https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=' + photoref + '&key=' + key; request(url_in, function (error, response, body) { if (!error && response.statuscode == 200) { console.log(body); // show html google homepage. } }); } });
i want string image url. object representing webpage.
any appreciated.
it not possible image url
per documentation url not returned api.
https://lh3.googleusercontent.com/-b8fwohhu2_k/vtdyjefjrhi/aaaaaaaaad8/jsjamjx4xya/s1600-w400/
your image url
already
imageurl = 'https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=' + photo_reference + '&key=' + api_key; // ^^^ return image (hence, image url)
you can use image url 1,000 free requests per 24 hour period. can increase limit free of charge, 150,000 requests per 24 hour period, enabling billing on google api console
hope helps!
Comments
Post a Comment