Skip to content

Instantly share code, notes, and snippets.

@colby
Last active August 29, 2015 14:14
Show Gist options
  • Save colby/a2515eaf6a6085afaf7d to your computer and use it in GitHub Desktop.
Save colby/a2515eaf6a6085afaf7d to your computer and use it in GitHub Desktop.
Imgur bash function to upload images
# Note: uses some random ClientID for authentication, does not handle errors
# Usage: $ imgur ~/Desktop/oleg.png
function imgur {
[ $# -lt 1 ] && echo "imgur: requires an image file path" && exit 1
curl -sH "Authorization: Client-ID 3e7a4deb7ac67da" -F "image=@$1" "https://api.imgur.com/3/upload" | grep -oE "http:.*\.[a-z]{3,4}" | tr -d '\'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment