我想知道是否可以在公共网站上访问/显示存储在谷歌驱动器中的图像等文件。


当前回答

我发现了一个非常有用的api/url:

imageId ->文件ID Width,期望的宽度(不能大于图像分辨率宽度),必须为整数才能工作 高度,期望的高度(不能大于图像分辨率高度),必须为整数才能工作

https://drive.google.com/thumbnail?id=${imageId}&sz=w${width}-h${height}

注意:api/url将保持纵横比,因此它将在第一个维度停止

其他回答

更新:正如所宣布的,谷歌在2016年8月弃用了此功能。这是谷歌的最后一次更新。

在2013年4月,使用Chrome/webkit,以下对我来说是有效的:

1 .创建一个文件夹,名为。“公共” 2选中该文件夹,右键单击,选择“共享>共享”。点击。选择“任何人都可以访问” 3将文件拖放到文件夹中,并上传。 4右键单击文件,选择“详细信息”。Details-Fieldset中的一行读作“Hosting”。下面是一个url:

https://googledrive.com/..。

拖放该url到一个新的选项卡。复制并粘贴url并共享或嵌入到任何你喜欢的地方。

一个限制是,就HTTP而言,似乎只有安全的HTTP访问是可能的。

更新: 另一个限制是,谷歌驱动器可以打开的文件,将无法以这种方式访问。 也就是说,点击“详细信息”不会显示谷歌驱动器的url。

要克服这个问题:

右键点击有问题的文件,选择“打开>管理应用程序”:

在这里取消文件相关的应用程序 可选:Reload谷歌Drive 右键点击文件,选择“Details” 继续执行步骤#4

注意:上述过程的另一种选择是上传谷歌驱动器无法打开/未关联的扩展名的文件。

从谷歌驱动器帮助页面:

To host a webpage with Drive: Open Drive at drive.google.com and select a file. Click the Share button at the top of the page. Click Advanced in the bottom right corner of the sharing box. Click Change.... Choose On - Public on the web and click Save. Before closing the sharing box, copy the document ID from the URL in the field below "Link to share". The document ID is a string of uppercase and lowercase letters and numbers between slashes in the URL. Share the URL that looks like "www.googledrive.com/host/[doc id] where [doc id] is replaced by the document ID you copied in step 6. Anyone can now view your webpage.

如果你想在浏览器中查看文件,也可以使用类似于rufo和Torxed提供的方法:

https://drive.google.com/uc?export=view&id={fileId}

以下是来自@ https://productforums.google.com/forum/#!主题/传动/ yU_yF9SI_z0 /讨论

1-上传你的图片

2-右击并选择“获取共享链接”

3-复制链接应该看起来像

https://drive.google.com/open?id=xxxxxxx

4-换开场?加州大学吗?然后像这样使用它

<img src="https://drive.google.com/uc?id=xxxxx">

1.将您的图片设置更改为公共。

2.获取其可共享链接。

3.去这个网站并生成一个直接下载链接。

为我工作!