var image = new Image();
image.src = 'images/logos/jpg_group.jpg';
// image.src = VARimg_categoria[y];
image.onload = function() {
var canvas = document.createElement('canvas');
canvas.height = 250;
canvas.width = 250;
var context = canvas.getContext('2d');
context.drawImage(image, 0, 0);
var imageData = canvas.toDataURL('image/jpeg').replace(/^data:image\/(png|jpg|jpeg);base64,/, ""); //remove mimetype
for(var y = 0; y < VARimg_categoria.length - 1; y++) {
//image.src = VARimg_categoria[y];
DatecsPrinter.printImage(
imageData, //base64
canvas.width,
canvas.height,
1);
}
}
In this way he is loading the image into image.src
normal, but I need to load the images (paths), from the array: image.src = VARimg_categoria[y]
into the for
loop. How do I do this by loading load()
?