aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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");