Cordova plugin for getting photo album.
cordova plugin add cordova-plugin-photo-album
Before calling this plugin's method, you should first use the cordova.plugins.diagnostic plugin to determine the request permission. This plugin does not contain permission related logic.
window.PhotoAlbum.getAlbums(
(albums) => {
// type is PhotoAlbum.Album[]
console.log(albums);
},
(err) => {
console.log(err);
}
);
window.PhotoAlbum.getPhotoThumbnail(
imgId,
(base64) => {
console.log(base64);
},
(err) => {
console.log(err);
}
);
On Android, using imgPath yields the original image without compression.
On iOS, the image obtained using imgId is a cropped image with a maximum width and height of 1024.
window.PhotoAlbum.getPhotoData(
imgId,
imgPath,
(base64) => {
console.log(base64);
},
(err) => {
console.log(err);
}
);