Reputation: 1520
I am trying to make an app to list images like photo gallery in android. To do that, I used ngCordova camera plugin or Cordova image picker plugin. The plugins, however, need one-by-one image selection to get results by using touch event on photo library; plus, the limit option for the result. That is far from what I am going to. I am wondering how to retrieve all images rather than manual selection. Could you tell me how to approach?
Upvotes: 0
Views: 1282
Reputation: 3147
cordova-file is what you are looking for.
You can use this function to get all available files in a folder:
function listDir(path){
window.resolveLocalFileSystemURL(path,
function (fileSystem) {
var reader = fileSystem.createReader();
reader.readEntries(
function (entries) {
console.log(entries);
},
function (err) {
console.log(err);
}
);
}, function (err) {
console.log(err);
}
);
}
//example: list of www/ folder in cordova/ionic app.
listDir(cordova.file.applicationDirectory + "directory/path");
see this also: Cordova list all files from application directory (WWW)
Upvotes: 1