logger, imageProcessing

This commit is contained in:
Alex Holliday committed 2026-03-03 18:26:42 +00:00
1 parent 83572aa12a
commit 8e44718787
4 files changed
+21 -25

No files matched your search

+11 -15
View File
@@ -1,22 +1,18 @@
import sharp from "sharp";
const GenerateAvatarImage = async (file: Express.Multer.File) => {
try {
// Resize to target 64 * 64
let resizedImageBuffer = await sharp(file.buffer)
.resize({
width: 64,
height: 64,
fit: "cover",
})
.toBuffer();
// Resize to target 64 * 64
let resizedImageBuffer = await sharp(file.buffer)
.resize({
width: 64,
height: 64,
fit: "cover",
})
.toBuffer();
//Get b64 string
const base64Image = resizedImageBuffer.toString("base64");
return base64Image;
} catch (error) {
throw error;
}
//Get b64 string
const base64Image = resizedImageBuffer.toString("base64");
return base64Image;
};
export { GenerateAvatarImage };