Last active
January 2, 2018 10:32
-
-
Save cristihainic/69052db0dd5fc128cb7cb24257ea6890 to your computer and use it in GitHub Desktop.
Simple imgur image uploader via link or from local disk. Returns the link of the uploaded image.
This file contains 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 | |
if [[ $1 == http* ]]; | |
then | |
image=$1; | |
else | |
image=$(base64 $1); | |
fi | |
echo "Your uploaded image URL is:" | |
curl --request POST \ | |
--url https://api.imgur.com/3/image \ | |
--header 'authorization: Client-ID <INSERT_CLIENT_ID_HERE>' \ # get yours from https://api.imgur.com/oauth2/addclient | |
--data-binary "image=$image" \ | |
--data "type=binary" | jq '.data.link' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment