大家好,目前碰到了一个问题是一般情况下手机里面base64转成图片都能够正常显示,但是在Samsung note 20 ultra(android 12)下图片不会出现而是会显示错误的图片(类似乱码),请问什么样的情况会出现这样的情况?
(不好意思图片有点糊)
base64解码
window.aesImgDecrypt = function (aesImg) {
let pass = PublicData.getInstance().aesKeyPass.secret;
let key = CryptoJS.enc.Utf8.parse(pass);
let decrypt = CryptoJS.AES.decrypt(aesImg, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
let d = CryptoJS.enc.Utf8.stringify(decrypt);
return d.toString();
}
var img = new Image();
img.src = setBase64Title(type, base64);
img.onload = function () {
var texture = new cc.Texture2D();
texture.initWithElement(img);
texture.handleLoadedTexture();
var newframe = new cc.SpriteFrame(texture);
if (callback) callback(null, newframe);
};
img.onerror = function (e) {
if (callback) callback(e);
}
callback会把SpriteFrame设定给Sprite