You are not logged in.
I think this would be useful to you all as it painlessly uploads your images to imageshack and prints out a link to the image and a link that can be copy/pasted into forums for a clickable thumbnail. It's 100% written by me in Python. Requires cURL. It also shows a nice progress bar so you can see how far your upload has gone. Hope this helps!
Mirror 1: http://pastebin.com/f2d746452 Copy and paste into a file called imgupload.py
Mirror 2:
#!/usr/bin/python
import sys, os
#Define globals.
tmp = "temp.data" #Temporary file filename.
img = "" #Image filename.
ext = "" #File extension.
#Define functions.
def uploadsingle():
print("Uploading: " + img)
os.system("curl -H Expect: -F fileupload=\"@" + img + "\" -F xml=yes -# \"http://www.imageshack.us/index.php\" > " + tmp)
file = open(tmp, "r")
content = file.read()
#Get the image link.
start = content.find("<image_link>")
end = content.find("</image_link>")
link = content[start + 12 : end]
#Get the thumbnail link.
start = content.find("<thumb_link>")
end = content.find("</thumb_link>")
forum_link = content[start + 12 : end]
print("Image link:\t\t" + link)
print("Link for forums:\t[url= + link + ][img]" + forum_link + "[/img][/url]")
def uploadall(extension):
print("Uploading: *." + extension)
outfile = open("links.txt", "a")
list = os.listdir("./")
for fname in list:
if fname.endswith(ext):
print("Uploading: " + fname)
os.system("curl -H Expect: -F fileupload=\"@" + fname + "\" -F xml=yes -# \"http://www.imageshack.us/index.php\" > " + tmp)
file = open(tmp, "r")
content = file.read()
#Get the image link.
start = content.find("<image_link>")
end = content.find("</image_link>")
link = content[start + 12 : end]
#Get the thumbnail link.
start = content.find("<thumb_link>")
end = content.find("</thumb_link>")
forum_link = content[start + 12 : end]
#Append link data to the outfile.
outfile.write("File: " + fname + "\n")
outfile.write("Image link:\t\t" + link + "\n")
outfile.write("Link for forums:\t[url= + link + ][img]" + forum_link + "[/img][/url]\n\n")
os.system("rm " + tmp) #Remove temporary file.
#Process command line arguments and execute program.
if sys.argv[1] == "all":
ext = sys.argv[2]
uploadall(ext)
else:
img = sys.argv[1]
uploadsingle()
os.system("rm " + tmp) #Remove temporary file.
Last edited by solarwind (2008-12-23 18:30:40)
Offline
wouldnt call that "a nice progress bar", it totally screws up my terminal.... the percentage numbers would be enough... furthermore, it doesnt return the links to me:
curl: (55) select/poll returned error
Image link:
Link for forums:
EDIT: this time it worked, thank you very much! (the first error was probably connected to my bad connection)
Last edited by mienensuchkind (2008-03-26 08:21:15)
Offline
Are you the same author of this?
If so, and even if not so, is it possible to have the option of using http://xs.to, for example, instead of imageshack? The reason why I don't like imageshack is that it's painfully slow. Xs seems quite faster.
Thanks for your work
Have you Syued today?
Free music for free people! | Earthlings
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery
Offline
Are you the same author of this?
If so, and even if not so, is it possible to have the option of using http://xs.to, for example, instead of imageshack? The reason why I don't like imageshack is that it's painfully slow. Xs seems quite faster.
Thanks for your work
I am not the author of the script in the AUR. I have never seen it in my life. I'll try to add xs.to support.
Offline
Very nice. I'll take a look.
Offline
Very nice. I'll take a look.
I made one for petaimg too. If you want, I can post it.
Offline
dmz wrote:Very nice. I'll take a look.
I made one for petaimg too. If you want, I can post it.
Sure, I am trying to modify it a bit for my needs.
Offline
Wow, sweet script! One thing...
$ mv imgupload.py imgup
# chmod +x imgup
# mv imgup /usr/bin
...will make it so you can just type
$ imgup pic.img
from anywhere and upload it, so you don't have to run the Python interpreter all the time.
Once again, thanks. This is really awesome!
Last edited by wirenik (2008-10-02 04:33:34)
moljac024: No one really knows what happens inside /dev/null... it could be a gateway to another universe....
dunc: If it is, the people who live there must be getting pretty annoyed by now with all the junk we send them.
Offline
Nice script!
And I wanna know how can I colorize the out put info of this script? I do not know anything about python....
Last edited by andywxy (2008-11-23 12:04:01)
Offline
Take a look at how I do it in https://launchpad.net/fidefrag
Offline
Offline
FYI, the script can't be found at the link Solarwind posted anymore. You can find it here: http://aur.archlinux.org/packages/image … ack-upload
EDIT: Er, just kidding, this one's different.
Last edited by weasel8 (2008-12-23 19:28:56)
Offline
I was inspired by this script to make an uploader to my favorite image website, kimag.es. It will display a progress bar as it uploads and then spit out the uploaded URL. To use, run `sh kup.sh pic.png`. Here it is, in all it's one-lined glory:
curl -# -F userfile=@$1 http://kimag.es/index.php?action=upload|grep http://arch.kimag.es/share|cut -c112-150
[ lamy + pilot ] [ arch64 | wmii ] [ ati + amd ]
Offline
FYI, the script can't be found at the link Solarwind posted anymore. You can find it here: http://aur.archlinux.org/packages/image … ack-upload
No you can't find it there, that one's your script, this one's mine xD
I updated link and posted code right on the post. Thanks for letting me know of dead link.
Offline
great script elmar, thx a lot for your effort. added it to my .bashrc :>
imgup () {
curl -# -F userfile=@$1 http://kimag.es/index.php?action=upload|grep http://arch.kimag.es/share|cut -c112-150
}
imgup screen.png
Last edited by arch0r (2008-12-23 18:37:29)
Offline
weasel8 wrote:FYI, the script can't be found at the link Solarwind posted anymore. You can find it here: http://aur.archlinux.org/packages/image … ack-upload
No you can't find it there, that one's your script, this one's mine xD
I updated link and posted code right on the post. Thanks for letting me know of dead link.
Yeah, I realized that after trying it myself...oops. Thanks for fixing the link though, I love this script.
Offline
For anyone wondering, his PetaIMG upload script is here: http://bazaar.launchpad.net/~x-solarwin … aUpload.py
PetaIMG looks like a really nice ImageShack replacement. Thanks solarwind.
Offline
For anyone wondering, his PetaIMG upload script is here: http://bazaar.launchpad.net/~x-solarwin … aUpload.py
PetaIMG looks like a really nice ImageShack replacement. Thanks solarwind.
It is definately more flexible but I have had problems with it in the past (sometimes the images won't upload or they will upload but not display). ImageShack has some limitations but it has NEVER failed me. It also creates a nice thumbnail automaticlly for you so you can easily copy/paste the link to paste in a forum post. But you could just as easily create a thumbnail with imagemagick.
Offline
For anyone wondering, his PetaIMG upload script is here: http://bazaar.launchpad.net/~x-solarwin … aUpload.py
PetaIMG looks like a really nice ImageShack replacement. Thanks solarwind.
This is awesome! Thanks
Offline
linkmaster03 wrote:For anyone wondering, his PetaIMG upload script is here: http://bazaar.launchpad.net/~x-solarwin … aUpload.py
PetaIMG looks like a really nice ImageShack replacement. Thanks solarwind.
This is awesome! Thanks
Just out of curiosity, does it still work?
Offline
Yes I just used it.
Offline
You may also want to try
curl -s -F userfile=@$1 http://kimag.es/index.php?action=upload | grep http://arch.kimag.es/share | cut -c112-150 | xclip
You can access the adress with middle mouse button then. Great to use it as a custom action e.g. in thunar .
Edit: For those who like CTRL+V over middle mouse button:
curl -s -F userfile=@$1 http://kimag.es/index.php?action=upload | grep http://arch.kimag.es/share | cut -c112-150 | xclip -selection clipboard
You might also want to use xsel instead of xclip.
Last edited by Mo (2009-03-27 11:07:41)
Offline
Yeah using xclip with it makes it 20 times better.
Offline
I was inspired by this script to make an uploader to my favorite image website, kimag.es. It will display a progress bar as it uploads and then spit out the uploaded URL. To use, run `sh kup.sh pic.png`. Here it is, in all it's one-lined glory:
curl -# -F userfile=@$1 http://kimag.es/index.php?action=upload|grep http://arch.kimag.es/share|cut -c112-150
doesn't work anymore, donno why , any one can help fix it ?
This silver ladybug at line 28...
Offline
I guess....maybe something to do with this line in the page source ? ::
<input type="hidden" value="1" id="numval" />
This silver ladybug at line 28...
Offline