【发布时间】:2021-05-06 16:24:00
【问题描述】:
我试图在节点中使用 Google Drive API 托管图像。
await drive.files.create({
requestBody: {
role: "render",
type: "anyone",
},
});
const response = await drive.files.get({
fileId: "...",
fields: "webViewLink, webContentLink",
});
console.log(response.data);
我获得了一个图片的公共链接,我可以在 Google 云端硬盘中打开或下载该图片以便手动查看。
{
webContentLink: 'https://drive.google.com/uc?id=1dffGf_4R5W75xKGhx7n-nXsZPFA7NE1a&export=download',
webViewLink: 'https://drive.google.com/file/d/1dffGf_4R5W75xKGhx7n-nXsZPFA7NE1a/view?usp=drivesdk'
}
但这不是我想要的。
我希望公共图像为原始格式(jpg、png 等),并且应该能够像浏览器中的网站一样正常查看。
我希望我已经解释得够多了,非常感谢任何帮助:)
【问题讨论】:
-
很遗憾,我无法从
But this is not what I want. I want the public images to be in raw format (jpg, png, etc.) and should be able to be viewed normally like a website in the browser.了解您当前的问题。我为我糟糕的英语水平深表歉意。为了正确理解您的问题,您能否提供当前问题的详细信息和您的目标? -
你不能得到这个。但是,作为一种解决方法,如果您想将图像嵌入到网页中,您可以使用预览链接stackoverflow.com/a/62571215/11551468
-
Google Drive 是一个文件存储系统,而不是一个虚拟主机站点。
标签: node.js image google-drive-api