开发者

Automate ImageShack upload

I can't figure out how to make a script to upload a picture to ImageShack, and return the hotlink of the picture in BASH, can anybody whip up 开发者_如何学Goone for me? I was thinking to use curl.


Here is my solution:

#!/bin/bash

if [ $# -ne 1 ]
then
  echo "Usage: `basename $0` filename"
  exit
fi

image="$1"
mimetype=`file -b --mime-type $image`

curl -H Expect: -F "fileupload=@$image;type=$mimetype" -F xml=yes -# "http://post.imageshack.us/" | grep image_link | grep -o  http[^\<]*

If you don't like the progress bar, just replace -# with -s

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜