I'm trying to get the base64 code of an image with the camera bag device. I can not get is the image in its full size, base64 code I get is a part of it and not the whole picture.
var options = {
uri: $scope.imagen,
quality: 90,
width: 1280,
height: 1280};
window.ImageResizer.resize(options,
function(image) {
console.log("imagen "+image);
var img = document.getElementById("imagenCamara");
img.src = image;
}, function(error) {
console.log(error.code);
});
Resize the image and then charge a canvas.
var canvas = document.getElementById("myCanvas");
var img = document.getElementById("imagenCamara");
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
var dataURL = canvas.toDataURL("image/png");
var imagenBase64 = dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
The truth is that you can not be wrong, so I thought official but it is only a piece of the picture.