With these dialogs you can upload images to imageshack and download images from any direct link. Great for regular imageshack users. Its pretty self explanatory with its user friendly interface.
You can upload images here
You can view your uploaded images and download images here
I've been working out the bugs for a while so i finally decided to post so enjoy.
/*
Image uploader/downloader by Brando
This script was made on mIRC version 6.34 (also tested on version 6.3), so im not completely sure it will work on other versions.
mIRC version 6.34 can be downloaded at: http://mirc.com/get.html
If the images aren't uploading and your geting the retry error message, try increasing the keep-alive header.
For bugs PLEASE contact me on hawkee or swiftirc forums
*/
dialog -l is {
title "Image uploader"
size -1 -1 247 227
option dbu
list 1, 2 13 243 50, size
button "+", 2, 212 2 13 10
button "-", 3, 228 2 13 10
icon 5, 26 91 192 106
button "<", 4, 7 133 13 13, disable
button ">", 6, 227 133 13 13, disable
button "&Upload!", 7, 40 213 42 10
text "URL:", 8, 5 65 13 8
edit "", 9, 22 64 188 10, read autohs
button "&Clpb", 10, 213 64 30 10
button "&Close", 11, 162 213 42 10, ok cancel
button "&Uploaded Pics", 12, 101 213 42 10
text "", 13, 63 202 114 8, center
text "No preview available", 14, 87 137 68 8, center
text "Status:", 15, 5 79 20 8
text "Select files to upload", 16, 27 79 183 8, right
text "Images to upload:", 17, 5 3 46 8
}
dialog -l isv {
title "Imageviewer"
size -1 -1 264 238
option dbu
icon 1, 27 99 209 122
button "<", 2, 5 151 15 16, disable
button ">", 3, 244 151 15 16, disable
list 4, 4 17 257 54, size
button "&Delete", 5, 137 4 37 10
button "&Add image", 6, 179 4 37 10
button "&Close", 7, 221 4 37 10, ok cancel
text "URL:", 8, 3 86 14 8
edit "", 9, 29 85 212 10, read autohs
button "&Clpb", 10, 243 85 18 10
text "Location:", 11, 3 74 25 8
edit "", 12, 29 73 212 10, read autohs
button "&Clpb", 13, 243 73 18 10
text "No preview available", 14, 51 152 161 15, center
text "", 15, 75 226 110 8, center
text "", 16, 4 5 65 8, left
}
menu * {
Image uploader
.Upload images: is
.Download images: dialog -m isv isv
}
alias is {
set %i.mode $iif($1,$1,-m)
if (!$hget(is)) hmake is 50
dialog $iif($dialog(is),-v,%i.mode) is is
}
alias -l i.loadimg {
if ($did(is,1).sel) {
did -v is 5
did -g is 5 $qt($did(is,1).seltext)
did -h is 14
did -a is 13 $nopath($did(is,1).seltext)
if ($hfind(is,$did(1).seltext).data) did -ra is 9 $v1
else did -r is 9
}
else {
:error
if ($error) reseterror
did -v is 14
did -h is 5
did -r is 13
}
}
alias -l i.chkbutton {
if ($did(is,1).lines <= 1) did -b is 4,6
else {
did $iif($did(is,1).sel == 1,-b,-e) is 4
did $iif($did(is,1).sel == $did(is,1).lines,-b,-e) is 6
}
}
alias -l i.id {
:id
var %x upload $+ $r(0,$str(9,12))
if ($sock(%x)) goto id
return %x
}
alias -l iv.loadimg {
if ($did(isv,4).sel) {
var %x $did(isv,4,$v1)
did -h isv 14
did -v isv 1
did -g isv 1 $qt($hget(is,%x))
did -ra isv 15 $nopath(%x)
did -ra isv 12 $hget(is,%x)
did -ra isv 9 %x
}
else {
:error
if ($error) reseterror
did -vra isv 14 No preview available
did -h isv 1
did -r isv 9,12,15
}
}
alias -l iv.chkbutton {
if ($did(isv,4).lines <= 1) did -b isv 2,3
else {
did $iif($did(isv,4).sel == 1,-b,-e) isv 2
did $iif($v1 == $did(isv,4).lines,-b,-e) isv 3
}
}
on *:exit:{ hsave is is.dat }
on *:start:{
hmake is 50
hload is is.dat
}
on *:unload:{
echo -ag :(
hfree is
remove is.dat
}
on *:dialog:is:*:*:{
if ($devent == sclick) {
if ($did == 2) && ($msfile(.bmp,Select file,Upload)) {
if ($v1 == -1) noop $input(You've selected too many files.,ow,Error)
else {
var %x 1, %err $false
while ($msfile(%x)) {
if (!$regex($v1,/\.(?:jpe?g|png|bmp|ico|img|gif|swf|tiff?)$/i)) var %err $true
else did -a $dname 1 $msfile(%x)
inc %x
}
if (%err) noop $input(Some selected files were not supported image files.,oh,Error)
if (!$did(1).lines) did -ra $dname 16 Select some files to upload.
else did -ra $dname 16 Ready to upload ( $+ $did(1).lines $+ ) images.
did -c $dname 1 1
i.chkbutton
i.loadimg
}
}
elseif ($did == 3) && ($did(1).sel) {
did -d $dname 1 $v1
if ($did(1).lines) did -ra $dname 16 Ready to upload ( $+ $did(1).lines $+ ) images.
else did -ra $dname 16 Select some files to upload.
did -r $dname 9
i.loadimg
}
elseif ($did == 10) && ($did(9)) clipboard $v1
elseif ($did == 1) && ($did(1).sel) {
i.chkbutton
i.loadimg
}
elseif ($istok(4 6,$did,32)) {
did -c $dname 1 $calc($did(1).sel $iif($did == 4,-,+) 1)
i.loadimg
i.chkbutton
}
elseif ($did == 7) && ($did(1).lines) {
if ($sock(upload*,0)) {
if ($input(Upload in progress. Abort upload in progress?,ynw,Upload in progress)) {
sockclose upload*
did -ra $dname 16 Ready to upload ( $+ $did(1).lines $+ ) images.
}
else return
}
var %x $did(1).lines, %y
while (%x) {
if ($hfind(is,$did(1,%x)).data) {
dec %x
continue
}
var %i $i.id
sockopen %i load.imageshack.us 80
sockmark %i $did(1,%x)
inc %y
dec %x
}
if (%y) {
did -ra $dname 16 Uploading images 0 of %y complete.
if (%y < $did(1).lines) noop $input(Some of the chosen files have already been uploaded. Uploading %y images.,oi,Images already uploaded)
}
else {
noop $input(All of the chosen files have already been uploaded.,o,Error)
did -ra $dname 16 Select files to upload.
i.loadimg
i.chkbutton
}
}
elseif ($did == 12) dialog $iif($dialog(isv),-v,%i.mode) isv isv
}
elseif ($devent == dclick) && ($did == 1) && ($did(1).seltext) run $v1
elseif ($devent == close) {
unset %i.mode
sockclose upload*
}
}
on *:dialog:isv:*:*:{
if ($devent == init) {
var %x 1
while ($hget(is,%x).item) {
did -a $dname 4 $v1
inc %x
}
did -c $dname 4 1
did -a $dname 16 $hget(is,0).item images
iv.loadimg
iv.chkbutton
}
elseif ($devent == sclick) {
if ($did == 5) && ($did(4).seltext) {
hdel is $v1
did -d $dname 4 $did(4).sel
did -ra $dname 16 $calc($gettok($did(16),1,32) - 1) images
did -r $dname 9,12
iv.loadimg
iv.chkbutton
}
elseif ($did == 6) {
if ($sock(download)) {
if ($input(Image download in progress. Abort download in progress?,ynw,Download in progress)) sockclose download
else return
}
var %i $input(Input image url (must be direct link),ei,Image download), %len $len(%i)
if (!%i) return
if (!$regex(%i,/^(?:http:\/\/)?([^\/]+)(.+(jpe?g|png|bmp|ico|img|gif|swf|tiff?))$|[^\x3D]{ $+ %len $+ }/i)) noop $input(Unsupported image file.,oh,Error)
elseif ($hfind(is,http:// $+ $regml(1) $+ $regml(2))) noop $input(You've already downloaded this image.,oi,Error)
else {
did -h isv 1
did -vra isv 14 Downloading $qt(%i)
sockopen download $regml(1) 80
sockmark download $regml(1) $regml(2)
}
}
elseif ($did == 4) && ($did(4).seltext) {
did -ra $dname 9 $v1
did -ra $dname 12 $hget(is,$v1)
iv.loadimg
iv.chkbutton
}
elseif ($istok(2 3,$did,32)) {
did -c $dname 4 $calc($did(4).sel $iif($did == 2,-,+) 1)
iv.loadimg
iv.chkbutton
}
elseif ($did == 10) && ($did(9)) clipboard $v1
elseif ($did == 13) && ($did(12)) clipboard $v1
}
elseif ($devent == dclick) && ($did == 4) && ($did(4).seltext) run $hget(is,$v1)
}
on *:sockopen:upload*:{
if ($sockerr) {
.signal -n i.fail $sock($sockname).mark
sockclose $sockname
}
else {
var %i $md5($sockname), %img $sock($sockname).mark, %ext $regex(%img,/\.(\w+)$/), %ext $regml(1)
bread $qt(%img) 0 $file($qt(%img)).size &img
bset -t &cont 1 -- $+ %i $+ $crlf $+ Content-Disposition: form-data $+ $chr(59) name="fileupload" $+ $chr(59) filename=" $+ $nopath(%img) $+ " $+ $crlf $+ $&
Content-Type: image/ $+ %ext $+ $str($crlf,2)
bcopy &cont $calc($bvar(&cont,0) + 1) &img 1 -1
bset -t &cont $calc($bvar(&cont,0) + 1) $crlf $+ -- $+ %i $+ -- $+ $crlf
sockwrite -n $sockname POST / HTTP/1.0
sockwrite -n $sockname Host: load.imageshack.us
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname Keep-Alive: 1200
sockwrite -n $sockname Content-Type: multipart/form-data $+ $chr(59) boundary= $+ %i
sockwrite $sockname Content-Length: $bvar(&cont,0) $+ $str($crlf,2)
sockwrite $sockname &cont
}
}
on *:sockread:upload*:{
if ($sockerr) {
.signal -n i.fail $sock($sockname).mark
sockclose $sockname
return
}
var %x
sockread %x
if ($regex(%x,/<input type="text" onClick="track\('direct'\).+value="(.+)"\/>/i)) {
did -ra is 9 $regml(1)
tokenize 32 $did(is,16)
var %i $3 + 1
if (%i == $5) did -ra is 16 Uploaded $5 images.
else did -ra is 16 Uploading images %i of $5 complete.
hadd -m is $regml(1) $sock($sockname).mark
sockclose $sockname
}
}
on *:sockclose:upload*:{ .signal i.fail $sock($sockname).mark }
on *:signal:i.fail:{
if ($input(Upload failed on img $qt($1-) $+ . Click retry to upload the img again.,rh,Error)) {
var %s $i.id
sockopen %s load.imageshack.us 80
sockmark %s $1-
}
else {
tokenize 32 $did(is,16)
if ($calc($3 + 1) == $5) did -ra is 16 Upload complete.
else did -ra is 16 Uploading images $calc($3 - 1) of $calc($5 - 1) complete.
}
}
on *:sockopen:download:{
if ($sockerr) {
noop $input(Unable to download image.,oh,Error)
sockclose $sockname
}
else {
tokenize 32 $sock($sockname).mark
sockwrite -nt $sockname GET $2 HTTP/1.0
sockwrite $sockname Host: $1 $+ $str($crlf,2)
}
}
on *:sockread:download:{
if ($sockerr) {
noop $input(Error downloading image.,oh,Error)
sockclose $sockname
return
}
tokenize 32 $sock($sockname).mark
if ($0 == 2) {
var %x $true
while (%x) {
if (Content-Len isin %x) var %len $gettok(%x,2,32)
sockread %x
}
sockmark $sockname $sock($sockname).mark $iif(%len,$v1,$false)
return
}
var %fn $nopath($2)
while ($sock($sockname).rq) {
sockread &cont
bwrite %fn -1 -1 &cont
}
if ($3) && ($file(%fn).size >= $3) {
sockclose $sockname
did -ac isv 4 http:// $+ $1 $+ $2
hadd -m is http:// $+ $1 $+ $2 $longfn(%fn)
iv.loadimg
iv.chkbutton
}
}
on *:sockclose:download:{
tokenize 32 $sock($sockname).mark
did -ac isv 4 http:// $+ $1 $+ $2
hadd -m is http:// $+ $1 $+ $2 $longfn($nopath($2))
iv.loadimg
iv.chkbutton
}
This is very nice brando. Should be great for those picture junkies that are constantly uploading pictures to show everyone.
I'm actually about to release an image downloading and viewing script myself very soon (like hopefully within 48 hours assuming I'm as done with testing and correcting as I think I am) so naturally I find any image related script interesting right now but I really like this one.
I am a bit jealous looking at yours because I see how much simplier it is working with images in dialogs compared to the way I'm doing it with picwins.
Anyhow, well done and if your interested in mine it should be posted here sooner than later as long as things go according to plan.