tUpload images to imgur - scripts - various script and utils
 (HTM) git clone git://z3bra.org/scripts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit df123e5abf212e2a893be14930d1faff88aeaf89
 (DIR) parent 9d043c93e09a190fe647ef948a0f17a2997e318a
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Wed, 19 Mar 2014 13:37:16 +0100
       
       Upload images to imgur
       
       Diffstat:
         A imgurup                             |      30 ++++++++++++++++++++++++++++++
       
       1 file changed, 30 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/imgurup b/imgurup
       t@@ -0,0 +1,30 @@
       +#!/bin/sh
       +
       +# upload images to imgur.com
       +# appends links and deletion links to the log
       +# depends: curl
       +
       +# check if all args exist as files
       +for F in "$@"; do
       +    if ! test -f "$F"; then
       +        echo usage: $(basename $0) image ... && exit 1
       +    fi
       +done
       +
       +LOG=$HOME/.imgurlog
       +
       +# from http://imgur.com/tools/imgurbash.sh
       +APIKEY='b3625162d3418ac51a9ee805b1840452'
       +
       +# upload all
       +for IMG in "$@"; do
       +    RESP=$(curl -F "image=@$IMG" -F "key=$APIKEY" \
       +        http://imgur.com/api/upload.xml 2> /dev/null)
       +
       +    URL=$(echo $RESP | sed 's|.*<original_image>\(.*\)</original_image>.*|\1|')
       +    DELETEURL=$(echo $RESP | sed 's|.*<delete_page>\(.*\)</delete_page>.*|\1|')
       +
       +    echo "$URL" >> $LOG
       +    echo "$DELETEURL" >> $LOG
       +    echo "$URL"
       +done