the base64-encoded image is returned in the background, but I need to convert it to url before I can use it, so I need to convert base64 to blob object first, and then convert it to url using url method. But when base64 is converted to blob object, many methods are tried to report an error, as shown in the following figure:
what is the situation, my code:
function b64toBlob(dataURI) {
var byteString = atob(dataURI.split(",")[1]);
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; iPP) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ab], { type: "image/jpeg" });
}
var b= b64toBlob(a.base64);//a{"name":"2.jpg","base64":"(base64)"}
solve!