你好,smartface社区,
我需要帮助来转换回smartface.io图像的base64字符串。
例如,下面的代码将图像转换为base64
var img = new SMF.Image(e.file);
var blob = img.getBlob();
var base64StringDataForRegisterImage = blob.toBase64String();现在我有了另一个页面,在那里我从webservice接收base64字符串,但我无法将其转换为图像以分配给图像控件。
请协助工作代码来实现同样的目标。
谢谢
发布于 2016-03-19 17:38:30
您可以直接将图像字符串分配给SMF.UI.image对象的base64属性。
假设您在Page2上有一个名为imgProfilePic的图像对象。
var myBase64StringFromWebservice = (...) // base64 string from your service
var imgProfilePic = new SMF.UI.Image({
top: "20%",
left: "15%",
height: "20%",
width: "70%",
image: myBase64StringFromWebservice,
imageFillType: SMF.UI.ImageFillType.stretch
});
Pages.Page2.add(imgProfilePic);https://stackoverflow.com/questions/35922806
复制相似问题