init
parent
dd57aea261
commit
533234ac68
Binary file not shown.
After Width: | Height: | Size: 227 KiB |
Binary file not shown.
After Width: | Height: | Size: 224 KiB |
@ -1,25 +1,25 @@
|
|||||||
let fileName = "";
|
// let fileName = "";
|
||||||
|
|
||||||
window.addEventListener("load", function () {
|
// window.addEventListener("load", function () {
|
||||||
let input = document.querySelector('input[type="file"]');
|
// let input = document.querySelector('input[type="file"]');
|
||||||
input.addEventListener("change", function () {
|
// input.addEventListener("change", function () {
|
||||||
if (this.files && this.files[0]) {
|
// if (this.files && this.files[0]) {
|
||||||
fileName = this.files[0].name;
|
// fileName = this.files[0].name;
|
||||||
let img = document.querySelector("img");
|
// let img = document.querySelector("img");
|
||||||
img.onload = () => {
|
// img.onload = () => {
|
||||||
img.classList.add("visible");
|
// img.classList.add("visible");
|
||||||
input.classList.add("hidden");
|
// input.classList.add("hidden");
|
||||||
URL.revokeObjectURL(img.src); // no longer needed, free memory
|
// URL.revokeObjectURL(img.src); // no longer needed, free memory
|
||||||
};
|
// };
|
||||||
|
|
||||||
img.src = URL.createObjectURL(this.files[0]); // set src to blob url
|
// img.src = URL.createObjectURL(this.files[0]); // set src to blob url
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
const imageButton = document.getElementById("show-image");
|
const imageButton = document.getElementById("show-image");
|
||||||
|
|
||||||
imageButton.addEventListener("click", (e) => {
|
imageButton.addEventListener("click", (e) => {
|
||||||
let img = document.querySelector("img");
|
let img = document.querySelector("img");
|
||||||
img.classList.toggle("visible");
|
img.classList.toggle("hidden");
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
const userID = Math.round(Math.random() * 10000000000);
|
Loading…
Reference in New Issue