SHOW:
|
|
- or go back to the newest paste.
1 | const show_image = () => { | |
2 | let reader = new FileReader(); | |
3 | ||
4 | // Closure to capture the file information. | |
5 | reader.onload = (function() { | |
6 | return function(e) { | |
7 | // Render thumbnail. | |
8 | image_canvas.current.src = e.target.result | |
9 | image_canvas.current.style.display = "block" | |
10 | }; | |
11 | })(selected_file); | |
12 | ||
13 | // Read in the image file as a data URL. | |
14 | reader.readAsDataURL(selected_file); | |
15 | } |