J I C is a Javascript Image Compressor using HTML5 Canvas & File API that allows you to compress your jpeg & png images before uploading to the server (100% client-side and no extra libraries required!)
The true difference in the code is this specific block:
// ADD polyfill for sendAsBinary, since it is a non-standard, deprecated function
if (XMLHttpRequest.prototype.sendAsBinary === undefined) {
XMLHttpRequest.prototype.sendAsBinary = function (string) {
var bytes = Array.prototype.map.call(string, function (c) {
return c.charCodeAt(0) & 0xff;
});
// send ArrayBufferView to suppress Chrome warning message
this.send(new Uint8Array(bytes));
};
}
We went from this.send(new Uint8Array(bytes.buffer)); to this.send(new Uint8Array(bytes)); in order to take care of a Chrome warning.
Lastly, I just reformatted the code using WebStorm to pretty it up :)
Hey guys!
The true difference in the code is this specific block:
We went from
this.send(new Uint8Array(bytes.buffer));
tothis.send(new Uint8Array(bytes));
in order to take care of a Chrome warning.Lastly, I just reformatted the code using WebStorm to pretty it up :)
Thank you so much for the excellent library!