I am developing a phonegap application and use the navigator.getPicture method to get images.
How do I get the image:
navigator.camera.getPicture(onSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.FILE_URI }); function onSuccess(imageURI) { var image = document.getElementById('myImage'); image.src = imageURI; }
In the same way as in the example with phone book documents.
I want to be able to use imageURI and then convert it to image data to load it later. (I do not want to use PhoneGap FileTransfer)
So far, have I tried both Get Image Data in JavaScript? and How can you encode Base64 string in JavaScript ??
When I try the following,
function onSuccess(imageURI) { getBase64Image(imageURI); } function getBase64Image(img) {
And print out the dataURL before returning. I just get data:, as content.
Any ideas on what I'm doing wrong?
source share