[英]How to get raw image from a public url?
我试图在节点中使用 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 Drive 中打开或下载该图片以便手动查看。
{
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 等),并且应该能够像浏览器中的网站一样正常查看。
我希望我已经解释得足够多了,任何帮助都非常感谢:)
我只是发现,而不是这个......
https://drive.google.com/file/d/1-x3h_1lYrBat7K43LaiTlS9FqQttbbFW/view?usp=sharing
我可以传递缩略图,然后是这样的file id
......
https://drive.google.com/thumbnail?id=1-x3h_1lYrBat7K43LaiTlS9FqQttbbFW
这很好用,可以嵌入到img
标签的src
属性中......( 来源)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.