Created
April 4, 2012 14:50
-
-
Save dubgeiser/2302110 to your computer and use it in GitHub Desktop.
Upload Mac OS X screenshot to imgur.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Upload a screenshot to imgur "on the fly": | |
| # Let user select region, take screenshot | |
| # Upload screenshot to imgur.com | |
| # Print resulting url to image. | |
| # | |
| # @see http://api.imgur.com/examples | |
| # | |
| # API Key provided by Alan@imgur.com, replace with your own. | |
| api_key="b3625162d3418ac51a9ee805b1840452" | |
| url_api_upload="http://api.imgur.com/2/upload.xml" | |
| fn_image="/tmp/screenshot-`date +%Y-%m-%d-%H-%M-%S`.png" | |
| screencapture -ix $fn_image | |
| response=`curl -s -F "image=@$fn_image" -F "key=$api_key" $url_api_upload` | |
| echo $response | tail -1 | sed -E 's/.*<original>(.*)<\/original>.*/\1/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment