A simple, fast Dropbox photo gallery for your website.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
cache
data
lib
logs
models
routes
templates
tests
.dockerignore
.gitignore
Dockerfile
LICENSE.txt
README.md
composer.json
composer.lock
config_sample.php
docker-compose.yml
index.php
phpunit.xml
site.conf

README.md

unicorn

A Dropbox gallery for your website.

  • Host your own your pictures on your own site.
  • Rocket fast, local caching.
  • Support for custom templates.
  • Automatic, realtime updates using Dropbox's Delta API.

Getting started

The easiest way to get started is by using the pre-built Docker image:

docker run mre0/unicorn

Manual installation

  1. Get unicorn.

  2. Due to Dropbox restrictions I'm not allowed to share my application key with you. Create a new Dropbox app with the settings from the screenshot and put the credentials into config_sample.php. Afterwards, rename config_sample.php to config.php to activate it. Dropbox App settings

  3. If you don't have it already, install composer. After that run composer install inside the unicorn folder to install all dependencies.

  4. Upload the unicorn folder to your webserver.

  5. Each directory is a gallery. So create a directory at Dropbox/Apps/<your_app_name>/ and add a few images.

Now go ahead and enjoy your gallery.

Pro tip: You can also enable pretty URLs.
See the [Slim documentation] on how to enable them for your server.

With docker

  1. Open docker-compose.yml in your favorite editor
  2. Set UNICORN_KEY, UNICORN_SECRET and UNICORN_ACCESS_TOKEN to the values shown in your dropbox app's settings page.
  3. (Optional) Expose a different port than 8080
  4. Run docker-compose up to start run the application

Customization / Themes

The gallery uses Twig and is fully customizable via HTML and CSS. Look into the templates directory for inspiration.

Troubleshooting

What if my pictures don't show up?

By default, the gallery is updated every five minutes. This is a tradeoff between Dropbox API restrictions and keeping the gallery up-to-date. You can set the gallery to update more frequently in the config file, but this is discouraged. To refresh the gallery right now, open /admin in your web-browser in order to clear the cache.

After uploading unicorn to the server, make sure that all directories are writable by unicorn. Otherwise the pictures can not be cached and won't show up.

If your pictures don't show up in the gallery, the update process might have been terminated by the server, because some hosters don't allow long-running processes (longer than 30 seconds or so). As a workaround, try adding only a few albums at a time to work around this issue.

Copyright

Copyright (C) Matthias Endler http://www.matthias-endler.de

License

GNU General Public License version 3. See LICENSE.txt for details.

Credits

Unicorn makes use of the following projects.

  • Slim-Framework - A PHP micro framework
  • Slim-MVC - A skeleton MVC schema for slim.
  • Dropbox - An alternative PHP 5.3 SDK for the Dropbox REST API
  • Twig - The flexible, fast, and secure template engine for PHP
  • Responsive Layout - A fine tutorial on responsive design
  • Composer - The PHP package manager