从 picasa 检索全尺寸图像 link
Retrieve a full sized image from a picasa link
对于一个网站,我使用多个社交网络 API 来检索图片。目前我的问题是 Google 照片.
我关注this guide to open a google picker with the user picture, but when I click on a picture (inside the Picker), the only link that I have is somethink like https://picasaweb.google.com/userID/albumID#pictureID。
如果有人已经遇到这个问题或有解决方案...我来了!
感谢@Teyam,我能够检索全尺寸图片,这是我的做法:
1- 我使用 google 选择器从我的相册中检索图片(要实现 Google 选择器,请参阅 this Google Picker example)
2- 在函数 pickerCallback 而不是 returning docs[0].url 给用户,我 return the docs[0].thumbnails[0].url
3- 我将之前 url 中的 /s32-c/ 替换为 /s0/ 以获得全尺寸图片。
这是我的自定义 getPickerCallback:
function pickerCallback(data) {
var url = '';
if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {
console.log(data);
var doc = data[google.picker.Response.DOCUMENTS][0];
var thumbnails = doc[google.picker.Document.THUMBNAILS];
var url = thumbnails[0].url;
//now replace the /s32-c/ with /s0/ for full size image
url = url.replace("/s32-c/","/s0/")
}
var message = 'You picked: ' + url;
document.getElementById('result').innerHTML = message;
}
如果你想调整图片的大小,你可以在url中进行,比如你想要1200xsmth的图片,你可以在url中设置/s1200/。
对于一个网站,我使用多个社交网络 API 来检索图片。目前我的问题是 Google 照片.
我关注this guide to open a google picker with the user picture, but when I click on a picture (inside the Picker), the only link that I have is somethink like https://picasaweb.google.com/userID/albumID#pictureID。
如果有人已经遇到这个问题或有解决方案...我来了!
感谢@Teyam,我能够检索全尺寸图片,这是我的做法: 1- 我使用 google 选择器从我的相册中检索图片(要实现 Google 选择器,请参阅 this Google Picker example) 2- 在函数 pickerCallback 而不是 returning docs[0].url 给用户,我 return the docs[0].thumbnails[0].url 3- 我将之前 url 中的 /s32-c/ 替换为 /s0/ 以获得全尺寸图片。
这是我的自定义 getPickerCallback:
function pickerCallback(data) {
var url = '';
if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {
console.log(data);
var doc = data[google.picker.Response.DOCUMENTS][0];
var thumbnails = doc[google.picker.Document.THUMBNAILS];
var url = thumbnails[0].url;
//now replace the /s32-c/ with /s0/ for full size image
url = url.replace("/s32-c/","/s0/")
}
var message = 'You picked: ' + url;
document.getElementById('result').innerHTML = message;
}
如果你想调整图片的大小,你可以在url中进行,比如你想要1200xsmth的图片,你可以在url中设置/s1200/。