如何在网站上显示来自 Google Drive 的图像? [英] How do I display images from Google Drive on a website?
问题描述
我的一个客户已将一些照片上传到他们的 Google 云端硬盘 并希望我在他们公司的网站上展示他们的照片.我查看了用于在网页上显示 Google 云端硬盘内容的 文档,但似乎这只是在网页上显示内容的说明,它已经这样做了.
A client of mine has uploaded some photos to their Google Drive and would like me to display their photos on their company website. I reviewed the documentation for displaying Google Drive content on a web page, but it appears that this is simply the instructions for displaying the contents on a web page, which it already does.
我的问题是,如何直接在客户端的网页上显示内容?
My question is, how do I display the contents directly on the client's web page?
推荐答案
如果您有一些图像文件,只需将它们上传到您的 Google Drive 上的 public 文件夹,复制其 文件夹 ID 从地址栏(例如 0B0Gi4v5omoZUVXhCT2kta1l0ZG8)粘贴到 GDrives 选择您自己的别名(例如 myimgs) - 瞧!您可以使用例如一张一张地访问图像.http://gdriv.es/myimgs/myimage.jpg.
If you have some image files, just upload them to a public folder on your Google Drive, copy its folder ID from the address bar (e.g. 0B0Gi4v5omoZUVXhCT2kta1l0ZG8) and paste it into a form at GDrives to choose your own alias (e.g. myimgs) - and voila! You can access the images one by one using e.g. http://gdriv.es/myimgs/myimage.jpg.
如果您想在您的网站上嵌入整个文件夹(在框架中),您可以使用以下网址之一,将 [folderID] 替换为您自己的 ID:
If you want to embed a whole folder on your website (in a frame), you can use one of the following URLs, replacing [folderID] with your own ID:
- http://gdriv.es/myimgs/
- https://docs.google.com/文件夹/d/[folderID]/preview?rm=minimal
- https://drive.google.com/folderview?id=[folderID]
如果您更喜欢以 XML 或 JSON 格式获取文件列表,可以使用 YQL.
If you prefer to get the file list in XML or JSON, you can use YQL.
注意:您也可以使用 Google + 照片 来托管和嵌入您的图片.
Note: You can use Google + Photos to host and embed your images as well.
这篇关于如何在网站上显示来自 Google Drive 的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!