aboutsummaryrefslogtreecommitdiff
path: root/imagebin
blob: a5de360d99a8e1fa971fb998abafd4b2c2cd3cdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

# pastebin an image. if xsel is installed, copy the URL to the X clipboard.
# uses this API: https://ibin.co/tools.php
# no support for using a login + API key, don't need it.

url="$(
  curl -F file="@${1:-}" https://imagebin.ca/upload.php | \
    grep ^url: | \
    cut -d: -f2-
)"

if [ -n "$url" ]; then
  echo "$url"
  which xsel &>/dev/null && echo -n "$url" | xsel
fi