Better Dropbox Camera Uploads with CameraSync

Two weeks ago I wrote about my new Dropbox-based workflow for photos. Towards the end of the article, I mentioned how I was handling uploads from my iPhone:

The official Dropbox app recently gained the capability of automatically uploading photos to the Camera Uploads folder: this means every time I go out and take some photos, I can come back home, open the Dropbox app, let it do its magic, then delete the photos from my iPhone. The photos will be uploaded to the Camera Uploads folder, and sorted using the same Hazel workflow described above.

Thanks to a third-party app, I've managed to (partially) automate the process of uploading photos from my iPhone (and iPad) as soon as I get home. I'm now using CameraSync to upload photos to Dropbox automatically.

CameraSync's interface design isn't the prettiest one around, but the app is extremely useful and well-done (plus, the icon is sweet). CameraSync can upload photos and videos to a specific folder on Dropbox, but it also supports SkyDrive, FTP, Amazon S3, Flickr, and Box.net. As you can imagine, I'm using it to upload photos to the Dropbox folder I've already set up with my Hazel workflow.

The big advantage of CameraSync over the official Dropbox app is that it supports geofencing. First introduced by News.me and made popular by Marco Arment in Instapaper, background location sync is a feature that simply makes sense for this kind of app.

In the settings, you can add "locations" the app will monitor; as soon as you arrive at, say, your house or office, the app will start uploading photos without you having to manually launch anything. CameraSync will inform you of what it's doing through local notifications, and it's even got an option to only trigger background location sync if a WiFi network is found (so you won't consume 3G or 4G data). In this way, I can take as many photos as I want, go home, and let CameraSync do its job without having to "worry" about anything. First world problem: solved.

CameraSync has got more clever features up its sleeves, though. For instance, it comes with a "Content to sync" filter that allows you to automatically avoid uploading screenshots from the Camera Roll (they are saved as .png files). You can choose a specific "album" to monitor for new photos (such as a Photo Stream instead of the Camera Roll), and, obviously, the app is capable of only uploading new photos since the last upload session. Unfortunately, due to iOS' limitations, CameraSync can't "upload new files, then delete them" -- so you'll still have to do the last part of the process manually. It's a trade-off I can accept, knowing that CameraSync uploaded my photos every time I arrived at home.

Last, CameraSync preserves all Exif data associated with a photo, which comes in handy for my workflow. As it turns out, however, after I noticed an issue with timestamps, the developer of the app told me the Dropbox API isn't letting third-party developers set timestamps for uploaded files properly. This explains why, after using CameraSync, I ended up with files renamed (per my Hazel actions) with timestamps showing the upload date, rather than the actual modification date. And that was happening even though Finder could see the correct Exif data.

The developer of CameraSync was kind enough to provide a PHP script you can run to re-set the Exif data correctly. I simply added the following script to Hazel, and now all my photos uploaded with CameraSync are renamed with the correct timestamps. On line 2, make sure to change the timezone to yours.

<?php
date_default_timezone_set("Europe/Rome");
$date = exif_read_data($argv[1],"EXIF");
$date = $date["DateTimeOriginal"];
$time = date_parse_from_format("Y:m:d H:i:s",$date);
$time = mktime($time["hour"],$time["minute"],$time["second"],$time["month"],$time["day"],$time["year"]);
touch($argv[1],$time,$time);
?>

To run the script successfully in Hazel, add it before a renaming rule with the shell set to "/usr/bin/php" (without quotes). If you then use "Date modified" in the rule, you should see the correct Exif data for photos uploaded through the app.

CameraSync is a great example of an iOS app doing one thing very well. Its feature set is kept to the minimum, but the things it does are thoroughly refined and implemented in ways that make sense for iOS device owners -- such as background location sync.

If you upload photos to your Dropbox account on a regular basis, my recommendation goes to CameraSync.