Skip to content

Instantly share code, notes, and snippets.

@harsh183
Last active April 23, 2021 13:20
Show Gist options
  • Save harsh183/499831419d9121cd820217090c3adf3a to your computer and use it in GitHub Desktop.
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 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 }'
@harsh183
Copy link
Author

MIT License

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