从Dropbox目录中的网站库中提取和显示图像 [英] Pull and Display Images in Website Gallery from Dropbox Directory

查看:133
本文介绍了从Dropbox目录中的网站库中提取和显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与一个摄影师的客户一起创建一个简单的网站,我希望建立一个从Dropbox文件夹中提取的照片库,因此,每当她想更新画廊中的图像时,她都会只需将照片换出Dropbox文件夹即可.很简单,对吧?

I'm working with a client who is a photographer to create a simple website, and I was hoping to set up a photo gallery that pulls from a Dropbox folder, so whenever she wants to update the images in the gallery, she just has to swap the photos out of the Dropbox folder. Simple, right?

是否可以使用jQuery或PHP从Dropbox目录中提取图像并将其显示在网页上?我已经成功地从Dropbox上的文本文件中提取了文本,但是我不知道目录中的图像是否可以使用同样的方法.

Is there a way to pull images from a Dropbox directory using jQuery or PHP and display them onto a webpage? I have successfully pulled text from a text file on Dropbox, but I don't know if this same thing is possible for images in a directory.

我进行了一些Google搜索,但是不断获得结果,教我如何将图片上传和下载到Dropbox目录-不是我想要的.

I did some Google searching, but I kept getting results teaching me how to upload and download pictures to a Dropbox directory -- not what I want.

推荐答案

我前一段时间做过类似的事情.因此,是的,这是可能的.您可以搜索没有数据库的php库".您所需要做的就是为您的Dropbox的图片目录指定一个路径,并使其可以通过Web进行访问.

I have done a similar thing a while ago. So, yes, this is possible. You may search "php gallery without database". All you need is to specify a path to your Dropbox's images directory and make it accessible via web.

您需要了解Dropbox的工作原理吗?用两个词来说:它与Dropbox的服务器同步本地目录(在摄影师的计算机上为"C:/Dropbox/gallery/").之后,安装并使用摄影师帐户登录的Dropbox的其他所有实例都将获得"C:/Dropbox/Gallery/"的任何更改并将其应用于自己的副本(例如,"/var/www/Dropbox/gallery" ,例如在网络服务器上).

Do you need to learn how Dropbox works? In a two words: it syncs a local directory (let's say "C:/Dropbox/gallery/" at photographer's computer) with Dropbox's servers. After that, every other instance of Dropbox where installed and signed in with photographer's account will get and apply any changes of "C:/Dropbox/Gallery/" to the their own copy (let's say, "/var/www/Dropbox/gallery" e.g. on the web-server).

因此,首先,您需要在Web服务器上安装Dropbox( https://www .dropbox.com/install?os = lnx ).有问题吗如果是,则需要寻找其他方法.如果没有,您可以编写一个简单的函数/类,该函数/类将扫描所服务的Web目录(例如/var/www/Dropbox/gallery)以查找图像,并生成图像的可通过网络访问的路径.

So, first of all you need to install Dropbox on the web server (https://www.dropbox.com/install?os=lnx). Is it problem? If yes, you need to find another way. If not, you may just write a simple function/class which will scan served web dir (like /var/www/Dropbox/gallery) for images and generate a web-accessible paths to the images.

最简单的例子:

<?php
$images = glob("/var/www/Dropbox/gallery/*.*");
for ($i=0; $i<count($files)-1; $i++)
{
    $img = $images[$i];
    echo '<img src="/'.$img.'" alt="random image" />";
}
?>

此外,您可能对此感兴趣:我的PHP DropBox Gallery 1.0 Beta

Also, you maybe interested in this: My PHP DropBox Gallery 1.0 Beta

这篇关于从Dropbox目录中的网站库中提取和显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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