I have an issue in encoding images to base64 with phonegap, I tested the code over android 4 and iOS devices and it is working fine but when I tested it on android version 2.3 it didn't work. here is my code:
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); var dataUri = c.toDataURL("image/png"); alert(dataUri); }; img.src = filePath; the output of this code on android 2.3 is always empty string