F.J Kong's Blog

BRAVO HOTEL ONE SIERRA CHARLIE WHISKEY

How to quickly post image to IRC

http://img.vim-cn.com/
elimage(1)                         ELIMAGE                           elimage(1)

NAME
    Elimage: CLI Image Pastebin

SYNOPSIS
    curl -F 'name=@/path/to/image' http://img.vim-cn.com/

    or upload via your browser:
DESCRIPTION
    Paste image files with command line. You can give <span style="text-decoration: underline;">-F</span> more times to paste
    more images.

EXAMPLES
    $ curl -F 'name=@screenshot.png' http://img.vim-cn.com/
    <a href="http://img.vim-cn.com/97/2d8490849c8fab885218b478cc715ab0f3f4a9">http://img.vim-cn.com/97/2d8490849c8fab885218b478cc715ab0f3f4a9</a>

URLS
    <a href="http://p.vim-cn.com/">http://p.vim-cn.com/</a>
        A CLI code pastebin

    <a href="https://github.com/Vim-cn/elimage">https://github.com/Vim-cn/elimage</a>

TOOLS
    <a href="http://img.vim-cn.com/elimage">elimage</a>: script to quickly paste your images

                                24 Oct 2012                          elimage(1)

#!/usr/bin/env python
# vim:fileencoding=utf-8

# you may want change this
dest_url = ‘http://img.vim-cn.com/’
import sys
from subprocess import call
args = []
for f in sys.argv[1:]:
args.extend([‘-F’, ‘name=@’+f])
cmd = [‘curl’, ‘–compressed’, dest_url] + args
sys.exit(call(cmd))

and before I see this py script I made a Shell version:

 

#upload image to http://img.vim-cn.com
#By kroodywar3@gmail.com
#!/bin/bash

echo uploading:$1

result=`curl -F name=@$1 http://img.vim-cn.com/`

if [[ $result =~ ^http ]]; then
echo “upload succeed!”
echo -n $result |xclip -i
fi

#upload image to http://img.vim-cn.com
#By kroodywar3@gmail.com
#!/bin/bash

echo uploading:$1

result=`curl -F name=@$1 http://img.vim-cn.com/`

if [[ $result =~ ^http ]]; then
echo “upload succeed!”
echo -n $result |xclip -i
fi

and you can use scrot (console tool for taking screen shot)

alias uploadimg=’SCREENSHOT=/dev/shm/screen.png scrot -s $SCREENSHOT && upimge $screenshot’

Have fun

 

Leave a Reply