added uploade image script for imgur upload

This commit is contained in:
Niklas Kapelle 2023-11-01 23:17:43 +01:00
parent ac09714cc6
commit a0907a888f
Signed by: niklas
GPG Key ID: 4EB651B36D841D16

View 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'