Skip to content Skip to sidebar Skip to footer

Storing Captured Image Into SQlite Database? (Cordova)

So far I have got the camera api working for my app, to which the camera is opened when a button is clicked and once the image is taken it is displayed on the page. My next step i

Solution 1:

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
  document.getElementById("btnCamera").onclick = function() {
     navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
    destinationType: Camera.DestinationType.DATA_URL
 });
 };
          }
          function onSuccess(imageData){
           var image = document.getElementById("lastPhoto");
           image.src = "data:image/jpeg;base64," + imageData;
           //the imageData is a base64 representation of the image.
           base64imageData=imageData;// this variable is a global variable and when ever asked for u can send it to SQL Operation class for storing.
          }

          function onFail(message) {
            alert('Failed because: ' + message);
        }

Post a Comment for "Storing Captured Image Into SQlite Database? (Cordova)"