PhoneGap的显示图像的路径“cdvfile://本地主机/老大难” [英] Phonegap display images with the path 'cdvfile://localhost/persistent'

查看:791
本文介绍了PhoneGap的显示图像的路径“cdvfile://本地主机/老大难”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在深化发展与PhoneGap的应用程序,我想更新我的应用程序,它是在字preSS的内容。通过JSON API,我得到的网页中的HTML内容,但问题是获得的图像由用户选择。我所做的,是从送字preSS拉链到我的智能手机,其中包含新的HTML内容和新的图像。
我下载ZIP,应用新的HTML内容和图像复制里面的'cdvfile://本地主机/永久',这是翻译成/存储/模拟/ 0 /'与PhoneGap的,因为我使用它的Andr​​oid手机。我想显示一个HTML页面内的图像,但我不知道的链接访问/存储/模拟/ 0 /'我尝试链接文件:///storage/emulated/0/img.png 但似乎没有什么...任何想法?
我使用的是还在想着 imagecache 但我恐怕这将是慢用它代替我的方式...

I'm currently developping an app with phonegap and I want to update the content of my application which is on wordpress. Through an JSON API, I get the html content of the pages, but the problem is getting the images choose by the user. What I have done, is send a zip from wordpress to my smartphone which contains the new html content, and the new images. I download the zip, apply the new html content, and copy the images inside 'cdvfile://localhost/persistent' which is translate to '/storage/emulated/0/' with phonegap because I use it on a Android phone. I would like to display the images inside an html page but I don't know the link to access to '/storage/emulated/0/' I try the link 'file:///storage/emulated/0/img.png' but nothing appears... any idea? I'm still thinking using imagecache but I'm afraid it will be slower to use it instead of my way...

推荐答案

最后,它是由于其他错误。
为了展示里面的存储/模拟/ 0 /'的形象与使用此PhoneGap的:

Finally it was due to other error. To show the image inside 'storage/emulated/0/' with phonegap using this :

<img src="cdvfile://localhost/persistent/img/photo-241x300.jpg" alt="">

效果很好。

这篇关于PhoneGap的显示图像的路径“cdvfile://本地主机/老大难”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆