显示来自Google云端硬盘文件夹的图像 [英] Display Images from Google Drive folder
问题描述
我正在尝试找到一个示例,说明如何在网页上使用JS调用特定Google云端硬盘文件夹中可渲染图像链接的列表.这是为了通过Modx和ModMore Digital Signage插件在Raspberry Pi上创建数字标牌的幻灯片显示.
I am trying to find an example on how to use JS on a webpage to call a list of renderable image links from a specific Google Drive folder. This is for the creation of a slideshow for digital signage on a Raspberry Pi via Modx and the ModMore Digital Signage plugin.
推荐答案
通过可渲染的图像链接,我假设您的意思是仅渲染的图像而不是仅图像链接.(措词有点困惑)
By render-able image links, I assume you mean images that just render in as opposed to just an image link. (kind of got confused a bit by the wording)
如果您想从Google Drive获取图像并将其显示在您的网站上,则必须采取一种方法.
If you want to grab an image from google drive and display it on your site, there is a method you have to undergo to do so.
方法您想要做的是在Google驱动器中找到该图片,然后右键单击该图片,然后按共享"按钮,访问该菜单后,打开高级",该图片应位于Google桌面的右下角弹出窗口.从这里,您应该看到与下面列出的共享链接相似的共享链接.
METHOD What you want to do is find the image in your google drive and right-click it and press the, 'Share' button and once you've accessed that menu, open up 'Advanced', which should be in the bottom right corner of the pop-up. From here you should see a share link similar to the one listed below.
https://drive.google.com/file/d/<LONG-ID>/view?usp=sharing
还要在此弹出窗口中,确保将私人图像共享"更改为开-知道链接的任何人".在该菜单上按完成".
Also on this pop-up, make sure to ensure that the Private image sharing is changed to, 'On - Anyone with the link'. Press 'Done' on that menu.
接下来,您需要复制以下链接:
Next what you need to do is copy the following link:
https://drive.google.com/uc?id=
然后,您需要从原始链接中复制,并将其粘贴到上面列出的链接中的'id ='之后.
Then you need to copy the from the original link and paste it after 'id=' in the one listed above.
它应该看起来像这样:
https://drive.google.com/uc?id=<LONG-ID>
据我所知,这差不多可以了.几年前,当我为网页创建JS横幅广告时,我就使用了该横幅广告,它可以正常工作,但您要记住,它不会产生.jpg或.png链接,即使这样也不会在大多数情况下都可以工作.我认为google不会对他们的系统进行太多更改,但是如果有更改,请给我通知,我将尝试看看是否有最新的解决方案.
And that's pretty much it to my knowledge. I've used this a couple of years back when I was creating a JS banner for a web-page and it worked fine but you have to keep in mind that it does not produce a .jpg or .png link, even so it will work in most cases. I don't think google will have changed their system too much, but if they have, give me a notification and I'll try to see if there's a more recent solution.
我强烈建议您仅将图像下载并嵌入到网页中,或者使用诸如Imgur之类的服务,因为其执行和过程非常简单.
I would strongly recommend just downloading and embedding the images into the web-page or using a service such as Imgur as the execution and process is so much simpler.
祝你有美好的一天!
这篇关于显示来自Google云端硬盘文件夹的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!