3 ms·
Resizing images before upload using html5 canvas
- oliwarner 14y agoIt's cool (it is) but if you just want to deploy something similar and don't want to get involved in the browser politics (IE/Safari/Opera don't support direct access to the filefield, and oh yeah, IE in general) you could do worse than to look at http://www.plupload.com/ http://www.plupload.com/ It supports HTML5 canvas resizing as well as offering Flash/Silverlight/Gears/BrowserPlus for resizing, and if the user doesn't have one of those, it falls back to standard upload form. And all under GPLv2 (only becomes an issue if you're distributing closed-source websites - eg a template, and perhaps not even then)
- josefrichter 14y agothanks. I know plupload. I just don't always want a huge do-it-all beast with garbage like flash, silverlight, etc.. And feel like experimenting myself. My code works in chrome/safari/firefox. in IE the upload will just go the old way (no resizing will happen).
- mgkimsal 14y agoDid this a couple years ago: http://kimsal.com/shrinker/ http://kimsal.com/shrinker/ Code doesn't work 100% of the time - it was a rough draft - no error handling - but it's up on github - pull requests welcome!
- josefrichter 14y agoyep that's similiar. many things changed though. the first thing I can see is that I work with multifile input, filereader and blobs.
- mgkimsal 14y agoI'd hit some snags then the project I was doing this on didn't need it anymore, so... it's sitting in limbo.