[Javascript] Resizing images client-side

Troy III Ajnej trojani2000 at hotmail.com
Fri Jul 13 18:34:15 CDT 2007


Hi Paul
 
Hahahahaa,
If I wasn't drunked last night and didn'tmcompletely missunderstood 
the problem, I believe it is very easy to get it done via javascript.
 
As I remember (?)Tedd asked about how to disable or prevent the 
client from uploading large pictures, suppose, not bigger than 500k.
 
All it takes is just a little bit of imagination or creativity. I will describe
the routine not the code itself since you all know how writte one.
 
You will need a "bypass function" for "submit".
1. get the picture file to load on the page.
2. use the onload event of the image object to check for image filesize. 
3. compare, the actuall f-size with your max limit size, and let the "con-
ditional" decide what statement to execute.
4 That is: alert box that tells the user the file exceeds the maximum 
alowed or submit it right away.
 
And it will all take only a second for the function to complete.
 
If I wasn't clear, please dont hesitate to ask. I might find some time to
actually write the code and post it here.
:)
Regards
 
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                        Troy III                            progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



> Date: Thu, 12 Jul 2007 19:18:31 -0700> To: javascript at latech.edu> From: paul at juniperwebcraft.com> Subject: RE: [Javascript] Resizing images client-side> CC: > > At 7/12/2007 06:11 PM, Troy III Ajnej wrote:> >Why don't you simply get the filesize of the image the client is about> >to upload (via client script) and hit him with the message: "this file is> >to large\n the file must be smaller than...," etc.> > > Hi Troy,> > I'd love to see your example of how this can be accomplished with JavaScript.> > Regards,> > Paul> __________________________> > Paul Novitski> Juniper Webcraft Ltd.> http://juniperwebcraft.com > > _______________________________________________> Javascript mailing list> Javascript at LaTech.edu> https://lists.LaTech.edu/mailman/listinfo/javascript
_________________________________________________________________
Local listings, incredible imagery, and driving directions - all in one place! Find it!
http://maps.live.com/?wip=69&FORM=MGAC01
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070713/79ccb7a0/attachment.htm>


More information about the Javascript mailing list