Created
January 8, 2015 06:04
-
-
Save rasshofer/79f5eca4b593465d6744 to your computer and use it in GitHub Desktop.
Upload a local image to PicPig via cURL using their API
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 | |
# Usage: bash picpig.sh {FILE} {API_KEY} | |
# Example: bash picpig.sh test.png abc123 | |
API="https://picpig.com/api/$2" | |
MIME=$(file --mime-type $1 | awk '{print $2}') | |
if [ ${MIME:0:5} == "image" ] | |
then | |
PICPIG=$(curl -fsk -F "image=@$1" $API) | |
echo "$PICPIG" | pbcopy | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can find your personal API key at https://picpig.com/api.