This code gets an image by input file
and "transforms" it into characters
Is there a way to reverse the situation, with the characters obtained in the console.log form the image again (throwing the image in the% div secondImageView
?)
Thanks and follow the code:
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("uploadImage").files[0]);
oFReader.onload = function (oFREvent) {
document.getElementById("uploadPreview").src = oFREvent.target.result;
console.log(oFREvent.target.result);
document.getElementById("txtimg").value = oFREvent.target.result;
};
};
<html>
<body>
<img id="uploadPreview" style="width: 200px; height: 100px; border: 1px #000 solid" />
<input id="uploadImage" type="file" name="myPhoto" onchange="PreviewImage();" /> <br /> <br />
<input id="txtimg" name="name_txt" class="txtimg" style="width:46px;" type="text"> <br>
<img id="secondImageView" style="width: 200px; height: 100px; border: 1px #000 solid" />
</body>
</html>