如何从 public url 获取原始图像?
How to get raw image from a public url?
我试图在节点中使用 Google 驱动器 API 托管图像。
await drive.files.create({
requestBody: {
role: "render",
type: "anyone",
},
});
const response = await drive.files.get({
fileId: "...",
fields: "webViewLink, webContentLink",
});
console.log(response.data);
我得到了一个 public link 我可以在里面打开的图像 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'
}
但这不是我想要的
我希望 public 图像为原始格式(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
属性中... (source)。
我试图在节点中使用 Google 驱动器 API 托管图像。
await drive.files.create({
requestBody: {
role: "render",
type: "anyone",
},
});
const response = await drive.files.get({
fileId: "...",
fields: "webViewLink, webContentLink",
});
console.log(response.data);
我得到了一个 public link 我可以在里面打开的图像 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'
}
但这不是我想要的
我希望 public 图像为原始格式(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
属性中... (source)。