我正在开发一个可以显示几个地方的照片的网站。我得到这样的照片:
var photos = typeof place.photos !== 'undefined' ? place.photos[0].getUrl({ 'maxWidth': 100, 'maxHeight': 125 }) : '';
if (photos.length) {//...//}
不幸的是,当我想显示照片时,它们的清晰度很差:
注意:我用 w3schools slideshows 显示照片然后我这样设置照片:
var images = document.getElementById("PhotoFond").getElementsByTagName("img");
for (i=0; i<images.length; i++;) {
if (!photosSlide[i]) {return;}
images[n - 1].src = photosSlide[i];
}
但是,当我转到谷歌地图并找到相同的照片 ( link to the same photo ) 时,质量更好。
我怎样才能有相同的分辨率?
最佳答案
photos[]: an array of PlacePhoto objects. A PlacePhoto can be used to obtain a photo with the getUrl() method, or you can inspect the object for the following values:
height: the maximum height of the image, in pixels.
width: the maximum width of the image, in pixels.
html_attributions: Attribution text to be displayed with this place photo.
.getUrl({ 'maxWidth': 1000, 'maxHeight': 1250 }) // Just set higher resolution, no?
关于javascript - 使用 js 和 google maps api v3(地点库)解析地点照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45374079/