Question

What is the parent DIV for the img? The tutorial on their website doesn't really explain anything about this code so I'm wondering how it actually works.

var imgData = publisher.getImgData();
var img = document.createElement("img");
img.setAttribute("src", "data:image/png;base64," + imgData);

// Replace with the parent DIV for the img
document.getElementById("containerId").appendChild(img);
Was it helpful?

Solution

parent div seems to be containerId. Somewhere in the html, you are expected to have an element with that id attribute:

<div id="containerId"> </div>

As you may know, you can display the captured snapshot without the parent id. you can simply append your img element to the document body:

document.body.appendChild( img );

Good Luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top