chrome packaged app image access

核能气质少年 提交于 2019-12-19 11:41:09

问题


I am having trouble accessing images in the chrome packaged app. These images are stored locally. Code works fine in the browser.

following image tag

   <img ng-src="pics/{{employee.pic}}">

I am using angularjs.

Thanks, Niranjan


回答1:


See:

https://developer.chrome.com/apps/app_external#external

What you have to do is fetch the binary contents of the image with XMLHttpRequest as a blob, then convert that blob to an object URL, and that's the URL you set as the src attribute of the img. It's easier than it sounds, and the cited web page gives you the code.



来源:https://stackoverflow.com/questions/20973989/chrome-packaged-app-image-access

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