compressedImg = function(path, prop) {
let img = new Image();
img.src = path;
img.onload = function() {
let that = this;
let w = that.width / prop;
let h = that.height / prop;
let quality = 1;
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d');
let anw = document.createAttribute("width");
anw.nodeValue = w;
let anh = document.createAttribute("height");
anh.nodeValue = h;
canvas.setAttributeNode(anw);
canvas.setAttributeNode(anh);
ctx.drawImage(that, 0, 0, w, h);
var imgUrl = canvas.toDataURL('image/jpeg', quality);
}
}
console