Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 24 May 2015, 21:37
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Imgur image upload GUI script
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message

Joined: 25 Feb 2010
Posts: 1400
Location: England. Dell Inspiron 1501. Dpup

PostPosted: Fri 09 Sep 2011, 11:08    Post_subject:  Imgur image upload GUI script
Sub_title: 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/


###GUI for imgur script by Bart Nagel <bart@tremby.net>###
###upload local image to www.imgur.com image hosting service###

  ### root password for user fido ###
  [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@}

TEXT=" Select an image to upload to www.imgur.com "
NAME="Imgur upload"

GUI1=$(yad --title="$NAME $VER" --text="$TEXT" --form --field="Image:FL" --button="gtk-quit:1" --button="gtk-ok:0")


   if [ "$GUI1" = "" ]; then
   echo "Exiting" && exit

case $BUTTON in

GETIMG="`echo $GUI1 | cut -d '|' -f 1`"
echo "$GETIMG"

# API Key provided by Alan@imgur.com

# 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

# 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

##thumb nail image##
url1="` echo $url |  cut -d "." -f -3 `"
format="` echo $url |  cut -d "." -f 4- `"

##imge links gui##
GUI2=$(yad --title="$NAME $VER" --text=" Cut and paste one of the image options from the boxes below " --form \
--field="Forum Thumb" "[IMG]$urlthumb[/IMG]" \
--field="Forum Full" "[IMG]$url[/IMG]" \
--field="Direct URL" "$url" \
--field="Delete page" "$deleteurl" \

   if [ "$GUI2" = "" ]; then
   echo "Exiting" && exit

    echo "Quit selected - Exiting" && exit
Back to top
View user's profile Send_private_message 

Joined: 08 Jul 2009
Posts: 5467
Location: Finland

PostPosted: Fri 09 Sep 2011, 14:06    Post_subject:  

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. Very Happy
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0455s ][ Queries: 12 (0.0038s) ][ GZIP on ]