Skip to content

Instantly share code, notes, and snippets.

@rasshofer
Created January 8, 2015 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rasshofer/79f5eca4b593465d6744 to your computer and use it in GitHub Desktop.
Save rasshofer/79f5eca4b593465d6744 to your computer and use it in GitHub Desktop.
Upload a local image to PicPig via cURL using their API
#!/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
@rasshofer
Copy link
Author

You can find your personal API key at https://picpig.com/api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment