Projects Stokkr

Why I am removing curated photo sync from Stokkr

Let me be honest right off the bat: I have not really worked on Stokkr since early 2018. Everything was working as intended and I just checked in every so often to make sure things were still up and running. However, when I checked in about a week ago, I noticed two things: Due to a failed sync in February, no photos had been synced in well over three months. And Stokkr had grown to just under 150 gigabytes in size due to how syncing images currently works. So, I had some work to do to avoid such long-lasting failures in the future and to stop the server from running out of disk space.

How Stokkr currently syncs images

Stokkr acts as “broker” between Unsplash and Dropbox. Photos are downloaded from Unsplash by a PHP script. This is triggered when a new curated collection is (or rather was) added or one of Stokkr’s users likes photos on Unsplash. Another PHP script then takes those photos and syncs them to Dropbox. However, the images remain on the Stokkr server indefinitely. Thus, the server fills up over time.

Why not just delete photos after syncing them to Dropbox? Simple: Because there is a better solution (which I did somehow not find out about back in 2017). What if, rather than downloading and then deleting files, Stokkr did not download the images at all?

How Stokkr will sync photos starting next week

Dropbox added a save_url feature to their API in 2015. Using that feature, Stokkr can just get a photo’s URL from the Unsplash API and then tell the Dropbox API to save that photo to a user’s account by providing no more than the URL and filename. That way, Stokkr does not use bandwidth down- and uploading photos and does not need to store any files on disk. I wrote a prototype-like PHP script that implemented this behavior in February of 2018. However, I never finished it and thus never deployed it – until now.

During the past week, I have taken that “prototype” and, well, re-written most of it. The result is a single script that combines the old sync scripts, is easier to maintain and much, much faster. But using this “API to API” approach also means that Stokkr will no longer be able to sync curated collections.

How this change affects curated collections

Curated collections were deprecated in September of 2018 and finally removed in September of 2019. This means that the respective Unsplash API endpoints are no longer available. The only reason Stokkr can still deliver the former curated collections’ photos is because they are stored on the server. Since the new sync procedure only uses the Unsplash and Dropbox APIs, Stokkr will no longer be able to sync those photos.

Yes, it would be absolutely possible to come up with a workaround that would allow Stokkr to keep syncing those photos. But since there are no new curated collections coming in, I will not spend time on keeping the feature alive. Instead, I am providing a .zip archive containing the images of all curated collections and putting my time towards developing new features.

So, here you go: Download all of Unsplash’s curated collections’ photos with a single click (6.5 gigabyte .zip archive).