title: Inserting base64 to sqlite in Phonegap
body: <p>In my Phonegap Project I need to store an image to sqlite by converting image to base64 string. Image size is 160kb. Image is not getting inserted. Is it because of the size?</p>
  
  <pre><code>var encodeImageUri = function(imageUri, callback) {
  var c = document.createElement('canvas');
  var ctx = c.getContext("2d");
  var img = new Image();
  img.onload = function() {
      c.width = this.width;
      c.height = this.height;
      ctx.drawImage(img, 0, 0);
  
      if(typeof callback === 'function'){
          var dataURL = c.toDataURL("image/jpeg");
          callback(dataURL.slice(22, dataURL.length));
      }
  };
  img.src = imageUri;
  </code></pre>
  
  <p>};</p>
  
  <pre><code>encodeImageUri('http://static.adzerk.net/Advertisers/030883e15a374ba397b57b8d4bf1033e.png', function(base64String)
                                    {
  
                                    populateBannerImage(base64String);
  
                                      });
  </code></pre>
  
  <p>In populateBannerImage , I m inserting base64 to db.</p>
  
  <pre><code>function populateBannerImage(imageData)
  </code></pre>
  
  <p>{</p>
  
  <pre><code> db.transaction(function(tx) {
  
                  tx.executeSql('INSERT INTO banners (id, name , banner_image_mobile, banner_image_mobile_ar, banner_image_tablet, banner_image_tablet_ar,banner_heading,banner_heading_ar, banner_title, banner_title_ar, url, url_ar, status, created_date, modified_date ) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',[JSONData.banner_id, JSONData.banner_name,JSONData.banner_image_mobile,JSONData.banner_image_mobile_ar, imageData, JSONData.banner_image_tablet_ar,JSONData.banner_heading,JSONData.banner_heading_ar, JSONData.banner_title, JSONData.banner_title_ar, JSONData.url, JSONData.url, JSONData.status, JSONData.created_date, JSONData.modified_date]);
  
                  });
  </code></pre>
  
  <p>}</p>
  
  <p>ImageData to db. I m new to this. Please help me </p>