mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: jimp thumb gen
This commit is contained in:
@@ -115,16 +115,17 @@ export const extractImageThumb = async(bufferOrFilePath: Readable | Buffer | str
|
|||||||
const { read, MIME_JPEG, RESIZE_BILINEAR, AUTO } = lib.jimp
|
const { read, MIME_JPEG, RESIZE_BILINEAR, AUTO } = lib.jimp
|
||||||
|
|
||||||
const jimp = await read(bufferOrFilePath as any)
|
const jimp = await read(bufferOrFilePath as any)
|
||||||
|
const dimensions = {
|
||||||
|
width: jimp.getWidth(),
|
||||||
|
height: jimp.getHeight()
|
||||||
|
}
|
||||||
const buffer = await jimp
|
const buffer = await jimp
|
||||||
.quality(50)
|
.quality(50)
|
||||||
.resize(width, AUTO, RESIZE_BILINEAR)
|
.resize(width, AUTO, RESIZE_BILINEAR)
|
||||||
.getBufferAsync(MIME_JPEG)
|
.getBufferAsync(MIME_JPEG)
|
||||||
return {
|
return {
|
||||||
buffer,
|
buffer,
|
||||||
original: {
|
original: dimensions
|
||||||
width: jimp.getWidth(),
|
|
||||||
height: jimp.getHeight()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user