Page MenuHomeSealhub

input-image-preview.stimulus.ts
No OneTemporary

input-image-preview.stimulus.ts

import { Controller } from "stimulus";
export default class InputImagePreview extends Controller {
id: string;
handleChange() {
const img = this.element.querySelector("img");
window.URL.revokeObjectURL(img.src);
const new_url = window.URL.createObjectURL(
this.element.querySelector("input").files[0]
);
img.src = new_url;
img.parentNode;
img.parentElement
.querySelectorAll("source")
.forEach((e) => e.parentNode.removeChild(e));
img.style.aspectRatio = "1";
}
}

File Metadata

Mime Type
text/x-java
Expires
Fri, Nov 22, 20:15 (1 d, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
547743
Default Alt Text
input-image-preview.stimulus.ts (494 B)

Event Timeline