Comments (4)
Ok this is not an issue. I found out that on android resolveLocalFileSystemURL doesn't work with full path. Need to call resolveLocalFileSystemURL for cordova.file.applicationStorageDirectory then loop through the entries to find the cached image.
It is mentioned in here: https://stackoverflow.com/questions/35192695/phonegap-cordova-for-android-file-plugin-error-code-1/35208599#35208599
The cache image is private to the application, so searching in explorer doesn't show it, unless the phone is rooted.
from cordova-plugin-imagepicker.
`
window.resolveLocalFileSystemURL(path, function (fileEntry) {
fileEntry.file(function(file) {
cb(file)
}, function() {
alert('error');
});
}, function (e) {
//window.alert("error: " + JSON.stringify(e));
//on Androi, need to loop
var dirEntry = function (entry) {
var dirReader = entry.createReader();
dirReader.readEntries(
function (entries) {
Array.from(entries).forEach(function (n, i) {
if (n.isDirectory === true) {
if (n.nativeURL.indexOf('/cacheCompressHelper') > -1 || n.nativeURL.indexOf('/Documents') > -1) {
var dirReader2 = n.createReader();
dirReader2.readEntries(function(files) {
//found the target /res directory
Array.from(files).forEach(function (f, i) {
if(f.isFile && f.nativeURL.indexOf(path)>=0) {
f.file(function(file) {
cb(file)
}, function() {
alert('error');
});
}
})
})
return false; //no need to iterate more
} else {
// Recursive -- call back into this subdirectory
dirEntry(n);
}
}
});
},
function (error) {
console.log("readEntries error: " + error.code);
}
);
};
var dirError = function (error) {
console.log("getDirectory error: " + error.code);
};
window.resolveLocalFileSystemURL(cordova.file.applicationStorageDirectory, dirEntry, dirError);
});
}
`
from cordova-plugin-imagepicker.
@hongnk I have same problem,and I don't understand stackoverflow's answer,Can you show your read image file code in here?thank you very much!: )
from cordova-plugin-imagepicker.
oh,I didn't have such a problem.
from cordova-plugin-imagepicker.
Related Issues (20)
- maximumImagesCount 为1的时候有问题
- 我想在capacitor上面使用这个,请问怎么使用? HOT 8
- ionic3中,限制一张图后,点击相机进行拍照后返回报错 HOT 1
- ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. HOT 2
- 能否迁移到安卓x HOT 1
- iphone 中文语言环境下,拍照和选择图片出现英文
- 子线程获取 vc
- Android手机中没有任何照片时无法显示第一个拍照按钮
- android-targetSdkVersion=29 the gallery doesn't work on devices with Android 10 HOT 3
- 在 Android 手机上没有弹出窗口来。 HOT 1
- 能否支持选择视频?
- Android 10 遇到兼容性问题,读取不到手机的相册图片 HOT 1
- 高版本android展示不出图片 HOT 1
- android10
- 查看单张图片的时候,右上角的完成按钮被遮挡 HOT 1
- Ionic How do you use it
- iPhone 11 压缩图片时间过长 compressed photos size HOT 6
- IOS13版本在点击完成完成按钮时闪退 HOT 9
- 小米手机选择相册时不显示图片的问题
- 使用方法 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-imagepicker.