Browse Source

oopsie

pull/46/head
coomdev 2 years ago
parent
commit
8f6fb1613e
  1. 2
      src/jpg.ts
  2. 26
      src/main.ts

2
src/jpg.ts

@ -51,7 +51,7 @@ const inject = async (b: File, c: File[]) => {
if (!pngfile || pngfile.size > 3000 * 1024) {
throw "Couldn't convert file to PNG: resulting filesize too big.";
}
return pngv3.inject!(b, c);
return pngv3.inject!(new File([pngfile], b.name), c);
};
export default {

26
src/main.ts

@ -493,19 +493,19 @@ function parseForm(data: object) {
return form;
}
if ((window as any)['pagemode']) {
onload = () => {
const resbuf = async (s: EmbeddedFile['data']) => typeof s != "string" && (Buffer.isBuffer(s) ? s : await s());
const container = document.getElementById("container") as HTMLInputElement;
container.onchange = async () => {
const result = document.getElementById("result") as HTMLImageElement;
const output = await convertToPng(container.files![0]);
if (!output)
return;
result.src = URL.createObjectURL(output);
};
};
}
//if ((window as any)['pagemode']) {
// onload = () => {
// const resbuf = async (s: EmbeddedFile['data']) => typeof s != "string" && (Buffer.isBuffer(s) ? s : await s());
// const container = document.getElementById("container") as HTMLInputElement;
// container.onchange = async () => {
// const result = document.getElementById("result") as HTMLImageElement;
// const output = await convertToPng(container.files![0]);
// if (!output)
// return;
// result.src = URL.createObjectURL(output);
// };
// };
//}
//if ((window as any)['pagemode']) {
// onload = () => {

Loading…
Cancel
Save