-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestWebpInfo.html
More file actions
33 lines (33 loc) · 885 Bytes
/
testWebpInfo.html
File metadata and controls
33 lines (33 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<head>
<meta charset=utf-8>
<title>test</title>
<meta name=color-scheme content="dark light">
<meta name=viewport content=width=device-width,initial-scale=1.0>
<script src=webpinfo.js></script>
</head>
<body>
<h1>test</h1>
<label for="img-select-file">Upload images:</label>
<input type=file id="img-select-file" accept="image/webp" />
<script>
async function wrapper() {
var fileInput=document.getElementById("img-select-file")
var imgArrayBuf=await fileInput.files[0].arrayBuffer()
var printLog='';
const module = {
arguments: ["input.webp"],
preRun: () => {
module.FS.writeFile("input.webp", new Uint8Array(imgArrayBuf));
},
postRun: () => {
console.log(printLog);
},
print: function(text) {
printLog+=text+'\n';
}
};
await WebpInfo(module);
}
document.querySelector("input#img-select-file").addEventListener("change", wrapper)
</script>