aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-10-26 22:25:23 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-10-26 22:25:23 +0300
commitbd6cef6f92503b9c6000938d941e42d7f7f5567c (patch)
tree2d95e1939fb258c9d53cdc6df13d557b9ec35eaa
parent9ad43ed4d41906af8ae33160b30d6cd6a6ae9bc0 (diff)
fix image save bugHEADmaster
-rw-r--r--src/lib/image.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/image.ts b/src/lib/image.ts
index 3f19128..69aa0b0 100644
--- a/src/lib/image.ts
+++ b/src/lib/image.ts
@@ -1,17 +1,17 @@
import { v4 as uuidV4 } from 'uuid';
-import { writeFileSync } from 'fs';
+import { writeFileSync, mkdir } from 'fs';
export function saveImg(img: string): string
{
if(!img) return null;
- let filename = `/images/${uuidV4()}.${img.split(';')[0].split('/')[1]}`;
+ let filename = `${uuidV4()}.${img.split(';')[0].split('/')[1]}`;
let path;
if(process.env.DEV) {
- path = `public/${filename}`;
+ path = `/public/${filename}`;
} else {
- path = `dist/client/${filename}`;
+ path = `/dist/client/${filename}`;
}
writeFileSync(path, img.split(',')[1], "base64");