1
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);
}
}
This way he is carrying the image in image.src
normal, but need to load the images (paths), from the array: image.src = VARimg_categoria[y]
within the loop for
. How do I do this by taking the charging time from load()
?
On the outside, if you have 3 img e.g. I only printed 1! I do not know if it is the return of the Datecsprinter function or if it is the load() that does not accompany the;
– Rodrigo
The loop creates multiple images and onload functions, one for each image. Maybe printImage can’t handle a queue of requests.
– bfavaretto