Skip to content

Instantly share code, notes, and snippets.

@cftang0827
Created November 4, 2018 07:14
Show Gist options
  • Save cftang0827/02713cefd94ef14bbdcc162ef6cfa974 to your computer and use it in GitHub Desktop.
Save cftang0827/02713cefd94ef14bbdcc162ef6cfa974 to your computer and use it in GitHub Desktop.
<html>
<head>
<script>
function show_image() {
document.getElementById("show").setAttribute("src", "data:image/jpeg;base64," + document.getElementById('base64_img').value);
}
</script>
</head>
<h1> Base64 encoding</h1>
<p> input base 64 encode below: </p>
<input style="height:200px; width:400px" id="base64_img"> <br>
<button type="button" onclick="show_image()"> Submit</button>
<br><br>
<img id="show" alt="Base64 image" width="200" src="">
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment