Images not showing up?

I had the idea of hosting this Ghost blog on Heroku, and with their new PostgreSQL DB feature, it seemed possible. It is, and a couple of blog posts and some mucking about on the command line things were up, running, huzzah!

I knew that since Heroku's file system is periodically overwritten (for instance, when pushing changes) that I wasn't going to be able to store image uploads on the server. No problem - I have a ton of Dropbox space.

However, when copying over links from Dropbox, the links weren't resolving to images, resulting in the (un)happy little broken image icon.

Turns out - as copied from the Finder, these links are hooked up to a Dropbox splash page, and not the actual images themselves:

The fix

You'll notice the links coming in from the Finder follow this format:

https://www.dropbox.com/s/448oifrzy62dnze/profile2_hq_md_square.jpeg?dl=0

The dl=0 at the end is key - this is what tells Dropbox whether to directly "download" the image, or to display the splash page.

Changing this to a "1" will solve the issue for a given link:

https://www.dropbox.com/s/448oifrzy62dnze/profile2_hq_md_square.jpeg?dl=1

I'd incorrectly assumed that this was a counter for the number of downloads, and had ignored, but it turns out that it's a toggle between modes for Dropbox files.

So kids - eat your wheaties, and if you're direct linking Dropbox images from <a> tags and the like - change your "0"s to "1"s.

About the author
comments powered by Disqus