Hi Snehal,
To get Image object run: codeAppery("image_component_name").get(0) /code
Run the following code to get base64 string with encoded image from Image object.
codefunction getBase64Image(img) {
// Create an empty canvas element
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
Code: Select all
// Copy the image contents to the canvas
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
// Get the data-URL formatted image
// Firefox supports PNG and JPEG. You could check img.src to
// guess the original format, but be aware the using "image/jpg"
// will re-encode the image.
var dataURL = canvas.toDataURL("image/png");
return dataURL;
}
/code
After you get the base64 string you can send it to Appery.io Database. The same string can be received from Database in mapping to Image component Asset.
When gallery images set is generated go ahead and follow the tutorial.