remove final js
This commit is contained in:
1 parent
ce322a8e28
commit
b511cde849
12 files changed
+53
-250
No files matched your search
Executable
+22
@@ -0,0 +1,22 @@
|
||||
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();
|
||||
|
||||
//Get b64 string
|
||||
const base64Image = resizedImageBuffer.toString("base64");
|
||||
return base64Image;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export { GenerateAvatarImage };
|
||||
Reference in new issue
Block a user