Last active
April 23, 2021 13:20
-
-
Save harsh183/499831419d9121cd820217090c3adf3a to your computer and use it in GitHub Desktop.
Uploads the latest picture in my /Pictures directory to IMGBB and uses jq to parse out the image url
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
# This script goes into my Pictures/ folder and uploads it to ffsend. | |
# Requires: jq | |
set -e | |
cd ~/Pictures # configure to other source of pictures if you want | |
API_KEY="[YOUR KEY IT'S FREE TO GET]" | |
FILE_NAME=$(ls -rt | tail -n 1) | |
IMAGE=$( base64 "$FILE_NAME" ) | |
curl --location --request POST "https://api.imgbb.com/1/upload?key=$API_KEY" --form "image=$IMAGE" | jq '. | { url: .data.image.url }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MIT License