Posted: Fri 09 Sep 2011, 11:08 Post subject:
Imgur image upload GUI script Subject description: for imgur.com image hosting.
Here is a Yad GUI script for uploading an image from your computer to imgur.com image hosting and generates links needed for easy cut and paste into forum posts etc.
script (requires Yad) name it imgur and put it in PATH /usr/bin/ or /root/my-applications/bin/
Code:
#!/bin/bash
###GUI for imgur script by Bart Nagel <bart@tremby.net>###
###upload local image to www.imgur.com image hosting service###
##Stu90###
#
### root password for user fido ###
[ "`whoami`" != "root" ] && exec sudo -A ${0} ${@}
TEXT=" Select an image to upload to www.imgur.com "
NAME="Imgur upload"
VER="0.1"
# API Key provided by Alan@imgur.com
apikey="b3625162d3418ac51a9ee805b1840452"
# upload the image
response=$(curl -F "key=$apikey" -H "Expect: " -F "image=@$GETIMG" \
http://imgur.com/api/upload.xml 2>/dev/null)
# the "Expect: " header is to get around a problem when using this through the
# Squid proxy. Not sure if it's a Squid bug or what.
if [ $? -ne 0 ]; then
echo "Upload failed" >&2
exit 2
elif [ $(echo $response | grep -c "<error_msg>") -gt 0 ]; then
echo "Error message from imgur:" >&2
echo $response | sed -r 's/.*<error_msg>(.*)<\/error_msg>.*/\1/' >&2
exit 3
fi
# parse the response and output our stuff
url=$(echo $response | sed -r 's/.*<original_image>(.*)<\/original_image>.*/\1/')
deleteurl=$(echo $response | sed -r 's/.*<delete_page>(.*)<\/delete_page>.*/\1/')
echo $url
echo "Delete page: $deleteurl" >&2
This one is real handy quick and clean pics uploader and url creator.
Really nice. Thank you. This one definitively earns DOTdesktop and place in menu also.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum