Created
December 29, 2014 01:07
-
-
Save miracle2k/21a6ed83b05af6c3e608 to your computer and use it in GitHub Desktop.
Upload to imgur from your headless server
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 | |
# https://github.com/Ceryn/img | |
# Call with '-s' to target only a selection of the screen. | |
clientid='3e7a4deb7ac67da' | |
img=$1 | |
res=$(curl -sH "Authorization: Client-ID $clientid" -F "image=@$img" "https://api.imgur.com/3/upload") | |
echo $res | |
echo $res | grep -qo '"status":200' && link=$(echo $res | sed -e 's/.*"link":"\([^"]*\).*/\1/' -e 's/\\//g') | |
echo $link | |
#echo "$res" > "$img.error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment