12

Is there a way I can upload some photos to imgur.com via the command-line and get their direct link as result in a text file?

Seth
  • 58,122
αғsнιη
  • 35,660

2 Answers2

20

The list of (mostly third-party) tools on the imgur website (https://i.stack.imgur.com/7E7EQ.jpg) features three bash scripts:

  • Bart's Bash Script Uploader by Bart Nagel

    A simple bash script to upload an image to imgur from the commandline. Run imgur images/delicious/cake.jpg to upload, print the new URL to stdout, print the delete page URL to stderr and put URL on the X clipboard for easy pasting.

  • img Bash Script Uploader by Ceryn

    A minimalistic screenshot uploader for Linux. Supports screen selection.

  • Imgur-Screenshot by jomo

    A simple screenshot bash script for Linux and OS X. Just run the script and select a portion of your screen to upload. The direct link to the image is then copied to your clipboard.

tremby
  • 419
muru
  • 197,895
  • 55
  • 485
  • 740
  • Here is a simplified version for OSX (I arrived here when I googled this): https://gist.github.com/003044274b6176f66c22 – Dorian Jan 25 '16 at 23:09
2

i tried myself today on imgur and it's quite complex , the documentation is pretty bad written so the procedure is not clear . May i suggest to try imagebin.ca ?! cuz has a simpler API to upload files :

curl -s -F key="YOURKEY_JUST_REGISTER_ON_IMAGEBIN.CA_and go_on_profile_to get it" \
 -F file="@$1" \
 https://imagebin.ca/upload.php | awk -F':' '/url:/{gsub(/url:/,"") ; print $0 }'

if you are using linux and kde =>

qdbus org.kde.klipper /klipper org.kde.klipper.klipper.setClipboardContents "$(curl -s -F key="YOURKEY_________PLEASE_EDIT_IT" \
 -F file="@$1" \
 https://imagebin.ca/upload.php | awk -F':' '/url:/{gsub(/url:/,"") ; print $0 }' )"
user1088530
  • 121
  • 2