π Browser side image compress & upload example, Android 4.0 compatible.
https://blade254353074.github.io/image-compress/
This page contain the image compressing and uploading actions step by step.
- Install dependency & start the server
$ npm install
$ npm run server
1. File upload test server
I use two api interface to recive image file:
-
/api/upload/multiparty
Using expressjs/node-multiparty,
file at
/server/upload-multiparty.js
. -
/api/upload/multer
Using expressjs/multer,
file at
/server/upload-multer.js
.
And, I use expressjs/cors to make sure all the requests can be sent by browser, whatever crossing domain.
2. Browser side
- FilReader
- window.URL
- Canvas
- Blob
- BlobBuilder
- atob
- Uint8Array
- multipart/form-data
- FormData
- XMLHttpRequest
- Fetch
For details to see the article at https://sebastianblade.com/browser-side-image-compress-and-upload/.