title: How to get photo from Cordova Camera Preview Plugin?
body: <p>I am using this plugin 
  <a href="https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview" rel="nofollow noreferrer">Cordova Camera Preview Plugin</a></p>
  
  <p>When i take photo, i got an error. I dont know how to read image from this URL. i want base64 of that image.</p>
  
  <p>Here is error image:</p>
  
  <p><a href="https://i.stack.imgur.com/hivay.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hivay.png" alt="enter image description here"></a></p>
  
  <p>here is my HTML</p>
  
  <pre><code>&lt;div class="controls"&gt;
    &lt;div class="block"&gt;
      &lt;button id="startCameraButton"&gt;Start Camera at back&lt;/button&gt;
      &lt;button id="stopCameraButton"&gt;Stop Camera&lt;/button&gt;
    &lt;/div&gt;
  
    &lt;div class="block"&gt;
      &lt;p&gt;&lt;button id="startCameraAnotherPosButton"&gt;Start Camera at front&lt;/button&gt;&lt;/p&gt;
  
      &lt;p&gt;Color Effect:
      &lt;select id="colorEffectCombo"&gt;
        &lt;option selected value="none"&gt;None&lt;/option&gt;
        &lt;option value="aqua"&gt;Aqua&lt;/option&gt;
        &lt;option value="blackboard"&gt;Blackboard&lt;/option&gt;
        &lt;option value="mono"&gt;Mono&lt;/option&gt;
        &lt;option value="negative"&gt;Negative&lt;/option&gt;
        &lt;option value="posterize"&gt;Posterize&lt;/option&gt;
        &lt;option value="sepia"&gt;Sepia&lt;/option&gt;
        &lt;option value="solarize"&gt;Solarize&lt;/option&gt;
        &lt;option value="whiteboard"&gt;Whiteboard&lt;/option&gt;
      &lt;/select&gt;
      &lt;/p&gt;
    &lt;/div&gt;
    &lt;div class="block"&gt;
      &lt;button id="takePictureButton"&gt;Take Picture&lt;/button&gt;
      &lt;button id="switchCameraButton"&gt;Switch Camera&lt;/button&gt;
    &lt;/div&gt;
    &lt;div class="block"&gt;
      &lt;button id="hideButton"&gt;Hide&lt;/button&gt;
      &lt;button id="showButton"&gt;Show&lt;/button&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="pictures"&gt;
    &lt;p&gt;&lt;img id="previewPicture" width="200"/&gt;&lt;/p&gt;
    &lt;p&gt;&lt;img id="originalPicture" width="200"/&gt;&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is my app.js</p>
  
  <pre><code>var app = {
    startCamera: function(){
      console.log('starting camera');
      // var tapEnabled = true; //enable tap take picture
      var dragEnabled = true; //enable preview box drag across the screen
      // var toBack = true; //send preview box to the back of the webview
      var rect = {x: 100, y: 100, width: 300, height:300};
      cordova.plugins.camerapreview.startCamera(rect, "front", dragEnabled)
    },
    stopCamera: function(){
      cordova.plugins.camerapreview.stopCamera();
    },
  
    startCameraAnotherPos: function(){
      cordova.plugins.camerapreview.startCamera({x: 50, y: 100, width: 300, height:300, camera: "back", tapPhoto: true, previewDrag: true, toBack: false});
    },
  
    takePicture: function(){
      console.log('taking picture..');
      cordova.plugins.camerapreview.takePicture({maxWidth: 640, maxHeight: 640});
    },
  
    takepicturehandler: function(){
      console.log('taking..');
    },
  
    switchCamera: function(){
      cordova.plugins.camerapreview.switchCamera();
    },
  
    show: function(){
      cordova.plugins.camerapreview.show();
    },
  
    hide: function(){
      cordova.plugins.camerapreview.hide();
    },
  
    colorEffectChanged: function(){
      var effect = document.getElementById('colorEffectCombo').value;
      cordova.plugins.camerapreview.setColorEffect(effect);
    },
  
  
    init: function(){
      document.getElementById('startCameraButton').addEventListener('click', this.startCamera, false);
      document.getElementById('startCameraAnotherPosButton').addEventListener('click', this.startCameraAnotherPos, false);
  
      document.getElementById('stopCameraButton').addEventListener('click', this.stopCamera, false);
      document.getElementById('takePictureButton').addEventListener('click', this.takePicture, false);
      document.getElementById('switchCameraButton').addEventListener('click', this.switchCamera, false);
      document.getElementById('showButton').addEventListener('click', this.show, false);
      document.getElementById('hideButton').addEventListener('click', this.hide, false);
      document.getElementById('colorEffectCombo').addEventListener('change', this.colorEffectChanged, false);
  
      cordova.plugins.camerapreview.setOnPictureTakenHandler(function(result){
        console.log(result);
        document.getElementById('originalPicture').src = result[0];//originalPicturePath;
        document.getElementById('previewPicture').src = result[1];//previewPicturePath;
    });
  
    }
  };
  
  document.addEventListener('deviceready', function(){  
    app.init();
  }, false);
  </code></pre>