android - Phonegap 显示路径为 'cdvfile://localhost/persistent' 的图像

标签 android cordova

我目前正在使用 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/

相关文章:

android - 比较 SQLite 中的变量

android - 如何在 phonegap 中从手机加载和导入 CSS/JS 文件?

php - laravel 5 中的简单 websocket 实现

javascript - 从 Objective C 委托(delegate)回调到 Cordova 插件

java - Android 通讯录简单库?

java - Android Parcelable 转换错误

file - Phonegap/Cordova 3.6 - 通过 blob 下载文件 :file

android - Google Play 不接受 Apache Cordova

android - 在协调器布局中定位 View

android - 是否可以从 android 库中访问原始资源?