Skip to content

Instantly share code, notes, and snippets.

@mythmon
Created April 16, 2013 19:34
Show Gist options
  • Save mythmon/5398899 to your computer and use it in GitHub Desktop.
Save mythmon/5398899 to your computer and use it in GitHub Desktop.
function uploadImage {
curl -s -F "image=@$1" -F "key=SOME_IMGUR_KEY_THING" http://imgur.com/api/upload.xml | grep -E -o "<original_image>(.)*</original_image>" | grep -E -o "http://i.imgur.com/[^<]*"
}
scrot -s "/tmp/shot.png"
if [ $? -eq 0 ]; then
uploadImage "/tmp/shot.png" | xclip
rm "/tmp/shot.png"
notify-send "Uploaded screenshot to imgur. URL is on the clipboard."
else
notify-send "Screenshot cancelled."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment