gn

Student // Web Developer // Photographer // Videographer // Events Technician

Bye bye Dropbox

For the past few years Dropbox has been my faithful companion when it comes to sharing my photos, but as they’ve introduced more and more clutter, removed features in an attempt to monetise it, it has become less professional and I needed to find an alternative.

Hello sets!

As a recent small project, I have created a similar service to Dropbox which provides the same features and more. In short, it’s a web front-end to Amazon S3 and you can view the finished product here:

sets.garethnunns.com

Whilst I have tested it fairly extensively, I’m sure there are still some bugs to fix, so do get in touch with any suggestions of improvements.

How it works

Straight from Lightroom, I export the images into a local folder which has a Folder Action attached to it, which means that when any item is added to the folder the Automator workflow is triggered.

Automator Workflow

Firstly, it runs an AppleScript over all the subfolders adding the Folder Action to them, as folder actions are only triggered by items added to that folder, not in subfolders. This should mean that wherever in the local folder an image is placed the workflow should trigger.

Then all the images in each set are copied into their own thumbnails subfolder (which doesn’t trigger the workflow) and are scaled such that their width is 400 pixels as this is the largest a thumbnail could be shown on the site. For efficiency, a thumbnail is only created when one doesn’t already exist or there’s a more recent version of the full size image. My intention had been to do this at run time, alas my hosting did not have enough memory to handle the large files my camera produces.

Then all of the folders are zipped into archives, not including the thumbnails subfolders, allowing a whole folder of images to be downloaded, like Dropbox provides.

Lastly, this is all synchronised with Amazon S3, only adding the new/modified files and deleting old files that don’t appear on the local folder.

Web

Logic for serving content from Amazon S3 through Amazon CloudFront

When a set page is requested by a user, a call is made to S3 API using the PHP SDK which returns all the files stored. The page then returns a page with the thumbnails and links to the full size images. If it is a private set, signed URLs are used that expire after 5 minutes to ensure privacy. The photos are all requested by the browser through the images subdomain of my site which uses CNAMEs to essentially mask an Amazon CloudFront CDN. This takes the request for the image and serves it up from the closest data centre.

The name, path, date and encrypted password of the set are all stored in a MySQL table, which makes it look a bit better than just the folder name, and the data for each set is used in the Open Graph tags and Twitter Cards.

Problems

I’ve been having a few issues with Folder Actions triggering, as many others online seem to be too, which may just be a bug in Yosemite that might be shaken out in El Capitan. They work about 80% of the time and I can manually start it in Automator, so it’s not too bad.

The loading time is fairly good with each of the thumbnails being under 100kB usually, but with sets over 100 images it can take a while for the page to initially load. Furthermore, the photos served in the simple lightbox are the full size file (up to about 10MB), which is good in the regard that if people right click and save as they get the full image but they are quite timely to load, especially on mobile.

Future

I will of course continue to use Dropbox for personal files and I will keep developing the system to make it as easy as possible for me to keep sharing images.

Tags: code new web design projects site web