I need to build a Cordova app which will take a photo, show the photo taken on the app, and upload the photo to the server. Have reference to the following sample code
https://github.com/apache/cordova-plugin-camera/blob/master/doc/index.md
To show the photo taken, the following works for me
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;
}
But when I tried out the following, the photo did not show up.
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.FILE_URI });
function onSuccess(imageURI) {
var image = document.getElementById('myImage');
image.src = imageURI;
}
What have I missed? The documentation is wrong?
Thank you in advanced for your help!