Laya中base64图片的处理与裁切
base64大概的样子:
data:image/png;base64,iVBORw0KGgo…
base64读取:
var base64 = "data:image/png;base64,iVBORw0KGgo...";//请传入正确base64,此处只是演示
// base64转Blob函数
var dataURLtoBlob = function(base64Data) {
var byteString;
if (base64Data.split(",")[0].indexOf("base64") >= 0){
byteString = atob(base64Data.split(",")[1]);
}else{
byteString = Laya.Browser.window.unescape(base64Data.split(",")[1])