Just about everyone's likely heard about the Alfred gif sharing workflow over on destroytoday.com. If you haven't read it yet, I highly recommend doing that first (if you want to make sense of what I'm talking about at least). I immediately adopted this method and have been using it pretty much every day since.
There were a few shortcomings however:
The url you get has the name of the gif in it - quite often giving away an ever so crucial punchline!
I considered using a URL shortener (I even created a workflow for one at some point), but then you lose the ability to have image previews in apps that support them †.
- The way that the images were "tagged" (by way of naming that is) can sometimes be awkward when shared. For the purposes of finding an image, I like to tag it with any relevant keywords I can think of and in some situations, sharing that in the url is just weird.
Before I continue though, let me just say that I'm in no way trying to steal @destroytoday's idea here. I simply took what he gave us and improved it to scratch my own itch.
What I've done
In my previous article, I showed how to create an alfred workflow script action using Node. This is what I decided to write my new action with.
Note: This means that you need to have Node.js installed to use this workflow.
Here's the outline of what I wanted to happen:
- When I choose the image, make a copy of it to another folder - I arbitrarily chose
- Rename the copied file in some obfuscated way - I decided to use a timestamp as it will always be unique.
- Keep a file that will map the relationship with the original file and the obfuscated one - I chose for it to be a simple JSON file.
The great thing here is that because we're using a file filter input you can have other folders as well. I have one set up so I have a bunch of "memes" readily at hand too for example.
_Note: _ If there's any interest, I can go into the details of how I implemented all of this. If you're interested, you can see the code on github (or within the workflow itself) for the moment.
On Dropbox space
Because I'm storing the obfuscated copy in a different folder, this will use up a lot more space on Dropbox, so just bear that in mind if you're going to use it.
The only thing you need to do is update the variables in the
Lastly, you may need to update the location of your folder in Dropbox, which you can do as follows:
With all that being said and done, you can download the workflow and have a play yourself.
† There may well be a shortening service that takes care of this, but I've yet to come across it.