开发者

Automate ImageShack upload

开发者 https://www.devze.com 2023-03-23 09:07 出处:网络
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

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

精彩评论

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