https://i.sstatic.net/xNkwl.pngIs there a way to efficiently convert multiple images at once using a for loop in Ionic 3?
Here is the code snippet I have:
for (let i in serviceData) {
// for(let i=0; i< this.adviceArray.length; i++) {
console.log("online advices", serviceData[i]);
this.texto = serviceData[i].texto;
console.log("check online this.texto ", this.texto );
this.imagen = serviceData[i].imagen;
console.log("check online this.imagen", this.imagen);
this.convertToDataURLviaCanvas(serviceData[i].imagen, "image/jpeg").then(base64 => {
console.log("online base64", base64);
this.base64Image = base64;
console.log("online this.base64Image", this.base64Image);
// this.adviceArrays64.push({'texto': this.texto, 'imagen': this.base64Image});
});
console.log("outer online this.base64Image", this.base64Image);
this.adviceArrays64.push({'texto': this.texto, 'imagen': this.base64Image});
console.log("online this.adviceArrays64", this.adviceArrays64);
this.storage.set("travelTips64", this.adviceArrays64);
}
I'm having trouble getting the full base64 strings of all images. How can I efficiently convert image URLs into base64 strings within an array and display all converted images in offline mode using Ionic 3?
Please provide a solution as soon as possible.