如何查找和使用直接链接到在Google云端硬盘中上传的图片 [英] How find and use direct link to image uploaded in Google Drive

查看:68
本文介绍了如何查找和使用直接链接到在Google云端硬盘中上传的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google云端硬盘上有这张图片:

I have this image on Google Drive:

https://drive.google.com/file/d/1zdEBhYircl9-P9Wtx-QyTgmxgskGLcEq/view?usp = sharing

我使用此脚本将图像和文本一起发送到Telegram:

And I use this script to send the image along with the text to Telegram:

function EnviarTelegram(botSecret, chatId, photoUrl, caption) {
    var response = UrlFetchApp.fetch("https://api.telegram.org/bot" + botSecret + "/sendPhoto?caption=" + encodeURIComponent(caption) + "&photo=" + encodeURIComponent(photoUrl) + "&chat_id=" + chatId + "&parse_mode=HTML");
}

但是,当我尝试使用电子表格中的公式发送消息时,由于无法获取图片,它返回了错误消息.

But when I try to use the formula in the spreadsheet to send the message, it returns in error for not being able to get the image.

使用时(删除此部分 view?usp = sharing ):

When I use (deleting this part view?usp=sharing):

https://drive.google.com/file/d/1zdEBhYircl9-P9Wtx-QyTgmxgskGLcEq/

可以发送消息,但仅发送图像的缩略图,不发送原始图像,因此质量低.

It ok to send the message, but sends only the thumbnail of the image, does not send the original image, so it goes with low quality.

有没有办法使用原始图像或仅使用这种低质量的缩略图?

Is there a way to use the original image or just this low quality thumbnail?

推荐答案

在您的情况下,我想提出以下两种模式.

In your situation, I would like to propose the following 2 patterns.

  • 模式1:

  • Pattern 1:

  • 使用 webContentLink ,例如 https://drive.google.com/uc?export=download&id= {fileId} .可以使用文件ID创建该URL.
  • 在这种情况下,请以查看者的身份公开共享文件.
  • Use webContentLink like https://drive.google.com/uc?export=download&id={fileId}. This URL can be created using the file ID.
  • In this case, please publicly share the file as the viewer.

模式2:

  • 当您无法公开共享文件时,如何使用修改后的缩略图链接?
  • 将缩略图链接的 = s220 替换为 = s1000 时,您可以更改图像大小.
  • 在这种情况下,您可以在此线程
  • 上查看示例脚本.
  • When you cannot publicly share the file, how about using the modified thumbnail link?
  • When =s220 of the thumbnail link is replaced with =s1000, you can change the image size.
  • In this case, you can see the sample script at this thread

这篇关于如何查找和使用直接链接到在Google云端硬盘中上传的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆