Using PhoneGap (Cordova), I am trying to get base64 image data of a photo selected from a photo library.
I could do it ... when the photo is taken from the camera, with the code snippet below in Cordoba.
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.DATA_URL
});
function onSuccess(imageData) {
var image = document.getElementById('myImage');
image.src = "data:image/jpeg;base64," + imageData;
}
function onFail(message) {
alert('Failed because: ' + message);
}
But what should I do to get base64 image data when the photo is selected from the library?
source
share