解决图片跨域问题
var imgs = new Image();
imgs.crossOrigin = "Anonymous"; //注意存放顺序
imgs.src = "http://192.168.0.107/ZHCX/CGZSIMG/1.jpg";
imgs.onload = function () {
var canvas = document.createElement('canvas');
canvas.width = imgs.width;
canvas.height = imgs.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(imgs, 0, 0, imgs.width, imgs.height);
var img1 = new Image();
img1.src = canvas.toDataURL("image/png");
alert("s")
}
imgs.onerror = function () {
alert("error")
}