views:

116

answers:

3

I have a dropbox account. I put a bunch of images in a public folder. I'd like to display the images using shadowbox.

Right now, I'm manually entering the filenames into this html file. Is there a way to dynamically update the gallery when I drag new images into the images folder?

I'd prefer javascript if it's possible. If it's not possible with javascript, any other suggestions to use shadowbox to automatically show a gallery of images stored on dropbox?

I know dropbox has their own gallery feature, but I'd like to use my own that's unbranded. Thanks for any help!

+5  A: 

Bad News First...

Javascript cannot read remote directories on the server, for security reasons. You'll have to use a server-side language instead.

Good News Last...

There appears to be a PHP Script that can access your dropbox account, and return the filenames to Javascript: http://forums.dropbox.com/topic.php?id=15660 - a demo can be viewed online at http://2boandco.com/demo-php-dropbox-gallery

Jonathan Sampson
Thanks for the answers. If I go the PHP route, do I have to have a server running?
jorel314
Yes, you will need a server that is php-ready. The chances are good that whoever is currently hosting your website has the ability to run PHP scripts too. Speak with your host for further details regarding that possibility.
Jonathan Sampson
Well, I'd like to just use Dropbox's free servers, and I don't think they let us use php. Maybe, I can write a python script named update.py that outputs an updated html file with all the images after I double click it.
jorel314
Jorel314, Your PHP Scripts wouldn't run on Dropbox, they would run on the server that hosts your website.
Jonathan Sampson
+1  A: 

The only think you could possibly do is name the files contiguously (1.jpg, 2.jpg), get the HEAD of them one by one, and then stop when you get a 404.

Robert S.
A: 

I ended up creating a python script that outputs the html I need to work with Shadowbox.

I just need to have a folder called "shadowbox" with the shadowbox files in it, a folder called "Full" with the actual images, and a folder called "Thumbs" with thumbnails that have the same name as the full image. Then the script will automatically create a file called "gallery.html".

Here's a sample.. http://dl.dropbox.com/u/154234/Images/gallery.html

Here's the python script for anyone interested in using it. I'm just a novice programmer, so any suggestions on how to make the code more elegant would be appreciated. Thanks!

http://dl.dropbox.com/u/154234/Images/update.py

jorel314