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) { if (!pngfile || pngfile.size > 3000 * 1024) {
throw "Couldn't convert file to PNG: resulting filesize too big."; 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 { export default {

26
src/main.ts

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

Loading…
Cancel
Save