简体   繁体   中英

How to set imageview.toImage() as html image src in webview?

any idea to set imageview.toImage() as img src in html of a webview.

let suppose I have an imageview (having some image in it).okay imageview.toimage() is treated as an image object in titanium. now what i need is i want to set

webview.html='<html><img src="here i want to put obove imageview.toimage()"></html>';

I tried many way anyone have experience of it please guide me.

regards:ali

将其保存到文件并分配文件的url路径或base64对图像进行编码,并将其提供为src参数的值

您可能会尝试将图像转换为base64 blob文本并将其用作CSS背景图像数据:

background-image:url('data:image/png;base64,'+Ti.Utils.base64encode(imageview.toImage()).getText()+'\');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM