URI:
       timgurup - scripts - various script and utils
  HTML git clone git://z3bra.org/scripts
   DIR Log
   DIR Files
   DIR Refs
       ---
       timgurup (673B)
       ---
            1 #!/bin/sh
            2 
            3 # upload images to imgur.com
            4 # appends links and deletion links to the log
            5 # depends: curl
            6 
            7 # use stdin if no file provided
            8 test -z "$@" && FILES='-' || FILES="$@"
            9 
           10 LOG=$HOME/.imgurlog
           11 
           12 # from http://imgur.com/tools/imgurbash.sh
           13 APIKEY='b3625162d3418ac51a9ee805b1840452'
           14 
           15 # upload all
           16 for IMG in "$FILES"; do
           17     RESP=$(curl -F "image=@$IMG" -F "key=$APIKEY" \
           18         http://imgur.com/api/upload.xml 2> /dev/null)
           19 
           20     URL=$(echo $RESP | sed 's|.*<original_image>\(.*\)</original_image>.*|\1|')
           21     DELETEURL=$(echo $RESP | sed 's|.*<delete_page>\(.*\)</delete_page>.*|\1|')
           22 
           23     echo "$URL"         >  $LOG
           24     echo "$DELETEURL"   >> $LOG
           25     echo "$URL"
           26 done