Upload a file from Finder to Cloudinary using Automator

X @urre

Upload a file from Finder to Cloudinary using Automator

Cloudinary is awesome. It’s cheap, fast, stores a lot of images even in the free tier and doesn’t take up data space in your apps and projects. You images loads fast everyhere with the CDN and you can also create transformations programmatically and on the fly without the need for graphic designers and fancy editing tools. Change formats, resize, crop and more.

Wouldn’t it be nice to upload images from your computer, ex blog images, screenshots etc directly to the Cloudinary Media Library and then be able to get back and paste a CDN link anywhere?

Install the Cloudinary CLI

Prerequisite: To use the Cloudinary CLI, you need Python 3.6 or later.

To use it in scripts or in Automator, first install the CLoudinary CLI

pip3 install cloudinary-cli

To make all your cld commands point to your Cloudinary account, set up your CLOUDINARY_URL environment variable.

export CLOUDINARY_URL=cloudinary://XXX:XXX@yourname

Check your configuration by running:

cld config

Create the Automator Workflow

  1. Open Automator
  2. Create a new Quick Action, give it a name ex. “Cloudinary”
  3. Set Workflow Recieves
  4. Select folders and files, and Finder
  5. Add a Run Shell Script and drag it over to the main window:
for f in "$@"
do
	/opt/homebrew/bin/cld uploader upload "$f" | /opt/homebrew/bin/jq -r '.secure_url' | /usr/bin/pbcopy
done

I’ve added a pipe command here to copy the URL to the uploaded image into your clipboard. You’ll need jq to parse the JSON and extract the HTTPS link.

This screenshot is in Swedish, but you get the idea.

Automator

How to use it

  1. Right click on a file in Finder
  2. Select “Cloudinary” under the Quick Action list Right click
  3. Just cmd + v in your project! The CDN URL is already in your clipboard.