I’ve used image sharing software for the past 5 years: CloudApp, Cloudup, Droplr, I tried them all. Those apps are great to quickly share screenshots, annotated images, gifs, or even screencasts with users. Sometimes, an image is worth a thousand words. :)
When I switched to Linux for my February challenge, I set out to find a cross-platform alternative to all those services. Here is what I came up with.
While all those media sharing apps usually work well, they have a catch: you’re not in control of your data. If that service ever goes down you’ll lose your images and only leave dead links behind. You’re also uploading a lot of things to a server you don’t own and control.
My solution: upload all those images to a server I own. This isn’t enough though. I need a solution where images will be automatically uploaded to that server as soon as I need them, and where the image URL will be copied to my clipboard so I can immediately use it.
Here are the tools I used to get this to work:
- A friendly hosting provider. I chose Webfaction, where this site is hosted. There, I set up an app where the files were be served via nginx, on a cookie-less domain, with caching headers set to
expires max
. - A domain set up to be cached and served via CloudFlare. This allows me not to worry about using too much bandwidth on my hosting plan. My images will also be served faster.
- Unison, installed on my machine and on my Webfaction plan (here is the tutorial). This will be used to automatically upload files from a specific directory on my machine to my app on Webfaction.
launchd
to trigger Unison every time an image is added to a specific directory on my machine.- The Alfred productivity app on Mac, and its paid powerpack. I only use this to trigger a script on demand.
- An Alfred workflow. It doesn’t do much: it listens to the
ig
command, and runs a bash script,automator /Users/username/Utilities/share-screenshots.workflow
- An Automator workflow that does a few things to get my images ready to be uploaded, and get me an URL once the image can be shared.
To summarize, here is the flow:
- I make a screenshot using Mac OS’s built-in screenshot feature.
- If I want to share that screenshot, I invoke my Alfred workflow.
- In turn, the Alfred workflow triggers the Automator workflow.
- The Automator workflow looks for images in the directory where Mac OS saves my screenshots. If it finds the image, it renames it (I don’t like the spaces in the screenshots saved by Mac OS), and moves it to another folder. It then picks the file name, and generates a URL I can share. It copies that URL to my clipboard.
- In the background,
launchd
and itsWatchPaths
option have noticed the new file in that folder, and triggered Unison. - Unison has synchronized that new file with the directory on my server.
- Done!
Want to see it in action? Here you go!
Magic!
If you’re willing to let your media sharing app go, this could be a good alternative in my opinion. Give it a try and let me know!
3 replies on “Share screenshots, own your data”
I prefer self hosting when I can. I love using Owncloud for cloud storage and file sharing, but I will definitely have to look into this one as well.
Oh, I remember Owncloud, I tried it as a replacement of Dropbox a few years back! Does it offer a solution to automatically upload and share screenshots?
You can easily use the owncloud client to upload and once its been uploaded easily share a link.