图片使用canvas.toDataURL()加密,在安卓与windows显示正常,ios和mc系统下显示失败

那鹏
2023-12-01
var obj = getValue();
var image = new Image();
image.src = obj.src;
var canvas = $('<canvas width="' + obj.width + '" height="' + obj.height + '"></canvas>')[0],
    ctx = canvas.getContext('2d');

ctx.drawImage(
    image,
    obj.x,
    obj.y,
    obj.width,
    obj.height,
    0,
    0,
    obj.width,
    obj.height);
var data = canvas.toDataURL("image/png");
 
_this.distory();
console.log(data);
$crop.data('src', data);
$("#crop_imgID").attr("src",data);

 类似资料: