I have a camera video and canvas.
Canvas accepts feed image when user clicks Submit
<video id="video" width="300" height="200" autoplay></video> </section> <section class="btn"> <button id="btnClick">Submit</button><br> </section> <section> <canvas id="canvas" width="300" height="300"> </section>
After the user has clicked the βSubmitβ button, he can click βShareβ to upload the image.
<input type="button" onclick="uploadEx()" value="Share" /> <form method="post" accept-charset="utf-8" name="form1"> <input name="hidden_data" id='hidden_data' type="hidden"/> </form>
I want to overlay another png on top of the image to the user. By sending the first binding by clicking the sharing button.
JS to upload pictures:
function uploadEx() { var canvas = document.getElementById("canvas"); var dataURL = canvas.toDataURL("image/png"); document.getElementById('hidden_data').value = dataURL; var fd = new FormData(document.forms["form1"]); var xhr = new XMLHttpRequest(); xhr.open('POST', 'uploadscript.php', true); xhr.upload.onprogress = function(e) { if (e.lengthComputable) { var percentComplete = (e.loaded / e.total) * 100; console.log(percentComplete + '% uploaded'); alert('Image uploaded'); } }; xhr.onload = function() { }; xhr.send(fd); };
How do I overlay a second image (for example, a watermark) on load?
source share