I use the following code to get in Phonegap (cordova 1.9.0) a photo from a gallery or from camera and include it in the page:
function getPhotoByGallery() {
navigator.camera.getPicture(onPhotoSuccess, onFail, {
quality : 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
});
}
function getPhotoByCamera() {
navigator.camera.getPicture(onPhotoSuccess, onFail, {
quality : 50
});
}
function onPhotoSuccess(data) {
var viewport = document.getElementById('viewport');
//console.log(data);
viewport.style.display = "";
document.getElementById("test_img").src = data;
}
Test-Device: Samsung Galaxy S3 with Android 4. Getting the Photos with the camera is no problem. But when I try to take a photo from the gallery several times, the app crashes frequently (without any usefull error) Not all the time but often and in different cycles. (Sometimes when picking an image from the gallery the third time, sometimes the fifth time and so on)
I have no idea what the cause of the problem could be since the app doesn't give me any feedback of the problem it encountered...