added uploade image script for imgur upload
This commit is contained in:
parent
ac09714cc6
commit
a0907a888f
14
.local/share/scripts/upload-image.sh
Executable file
14
.local/share/scripts/upload-image.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
|
||||
source $XDG_CONFIG_HOME/imgur.sh # exports: IMGUR_CLIENT_ID and IMGUR_CLIENT_SECRET
|
||||
|
||||
[ -z "$1" ] && read IMAGE_FILE || IMAGE_FILE="$1"
|
||||
[ -z "$IMAGE_FILE" ] && echo "No file provided" && exit 1
|
||||
|
||||
curl -X POST -H "Authorization: Client-ID $IMGUR_CLIENT_ID" -F "image=@$IMAGE_FILE" https://api.imgur.com/3/upload 2>/dev/null| jq --raw-output '.data.link'
|
||||
|
Loading…
Reference in New Issue
Block a user