Initial checkin
This commit is contained in:
commit
954ef3d036
95 files changed
+43476
No files matched your search
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Shows a pix if they add one
|
||||
*/
|
||||
document.querySelectorAll('input[type=file]').forEach(input => {
|
||||
|
||||
input.addEventListener('change', function () {
|
||||
|
||||
const preview = document.getElementById(
|
||||
this.dataset.preview
|
||||
);
|
||||
console.log("preview: ", {preview});
|
||||
if (!preview) {
|
||||
console.error(
|
||||
"Preview element not found:",
|
||||
this.dataset.preview
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!this.files.length) return;
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = e => {
|
||||
console.log("loaded");
|
||||
//console.log(e.target.result.substring(0,50));
|
||||
preview.src = e.target.result;
|
||||
preview.style.display = 'block';
|
||||
//console.log("preview.src = ", preview.src);
|
||||
};
|
||||
console.log("reading: ", this.files[0]);
|
||||
reader.readAsDataURL(this.files[0]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user