This cordova plugin allows to browse the phone's gallery and discovers every photos and videos.
This is a fork from this repository which contains the iOS implementation. The Android implementation is based on this other repository.
With cordova:
$ cordova plugin add https://github.com/mlemainque/cordova-plugin-cameraroll
window.cordova.plugins.CameraRoll.getPhotos(callback, [errorCallback]);
- callback: The callback that is called for each file found
- errorCallback: (Optional) The error callback
window.cordova.plugins.CameraRoll.getPhotos(function(URI) {
// Do something ...
}, function(err) {
console.log(err);
});
- Android
- iOS
window.cordova.plugins.CameraRoll.saveToCameraRoll(imageBase64, [successCallback], [errorCallback]);
- imageBase64: The base64-encoded data image URI that you want to save in the phone
- successCallback: (Optional) The success callback
- errorCallback: (Optional) The error callback
var base64String = 'data:image/png;base64,iVBORw[...]A89ub';
window.cordova.plugins.CamerRoll.saveToCameraRoll(base64String, function() {
// Do something
}, function(err) {
console.log(err);
});
- iOS