convert base64 string to image with javascript

混江龙づ霸主 提交于 2019-11-30 09:47:28

You can just create an img element and change its src with the required data:

<img src="data:image/png;base64,iVBORw0KGgoAAAANS..." />

For Titanium, you use the built in conversion utility Titanium.Utils.base64decode:

var imageFromBase64 = Titanium.UI.createImageView({
    image : Titanium.Utils.base64decode("iVBORw0KGgoAAAANS..."),
});

This converts a base64 string to a blob, which can be used in an ImageView.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!