diff --git a/src/jpg.ts b/src/jpg.ts index 517b34a..b659150 100644 --- a/src/jpg.ts +++ b/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 { diff --git a/src/main.ts b/src/main.ts index f18e4c6..daf5260 100644 --- a/src/main.ts +++ b/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 = () => {