我想知道是否可以在公共网站上访问/显示存储在谷歌驱动器中的图像等文件。
当前回答
更新:正如所宣布的,谷歌在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.
牛科技提供的解决方案对我很有效。
http://googledrive.com/host/<folderID>/<filename>
但有两个突出的问题
您不能在驱动器中的同一文件夹中有两个具有相同名称的文件,否则此链接将不起作用。 目前还不清楚,但谷歌似乎计划通过驱动器弃用图像托管。请看下面的链接。 https://support.google.com/richmedia/answer/6098968?hl=en
以下是来自@ 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">
一个解决方法是使用谷歌Drive SDK API获取fileId,然后使用这个Url:
https://drive.google.com/uc?export=view&id= {id}
这将是一个永久链接到您的文件在谷歌驱动器(图像或其他任何东西)。
注:此链接似乎受配额限制。所以不适合公开/大规模共享。
这是唯一的直接链接格式没有重定向(然后一个永久链接),只适用于文件直接可见的谷歌驱动器(例如图像和文档)。 它不受下载限制的影响,您可以使用它在网站上显示图像。
例如共享链接:
https://drive.google.com/file/d/FILE_ID/view?usp=sharing
就变成:
https://lh3.googleusercontent.com/d/FILE_ID
Lh4, lh5和lh6也有作用。