我目前正在使用 phonegap 开发一个应用程序,我想更新我在 wordpress 上的应用程序的内容。通过 JSON API,我获得了页面的 html 内容,但问题是让用户选择图像。我所做的是从 wordpress 向我的智能手机发送一个 zip,其中包含新的 html 内容和新图像。 我下载 zip,应用新的 html 内容,并复制“cdvfile://localhost/persistent”中的图像,因为我在 Android 手机上使用它,所以使用 phonegap 将其转换为“/storage/emulated/0/”。我想在 html 页面中显示图像,但我不知道访问“/storage/emulated/0/”的链接 我尝试链接“file:///storage/emulated/0/img.png” ' 但什么都没有出现......知道吗? 我还在考虑使用 imagecache但我担心用它代替我的方式会更慢......
最佳答案
最后还是因为其他错误。 要使用 phonegap 显示“storage/emulated/0/”中的图像:
<img src="cdvfile://localhost/persistent/img/photo-241x300.jpg" alt="">
效果很好。
关于android - Phonegap 显示路径为 'cdvfile://localhost/persistent' 的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23784480/