Update messages-media.ts

This commit is contained in:
kaatt
2022-11-14 05:14:50 +05:30
committed by Adhiraj Singh
parent 5c950dac10
commit cd9441fd0e

View File

@@ -111,7 +111,7 @@ export const extractImageThumb = async(bufferOrFilePath: Readable | Buffer | str
height: dimensions.height,
},
}
} else if('jimp' in lib && typeof lib.jimp.read === 'function') {
} else if('jimp' in lib && typeof lib.jimp?.read === 'function') {
const { read, MIME_JPEG, RESIZE_BILINEAR, AUTO } = lib.jimp
const jimp = await read(bufferOrFilePath as any)
@@ -160,7 +160,7 @@ export const generateProfilePicture = async(mediaUpload: WAMediaUpload) => {
quality: 50,
})
.toBuffer()
} else if('jimp' in lib && typeof lib.jimp.read === 'function') {
} else if('jimp' in lib && typeof lib.jimp?.read === 'function') {
const { read, MIME_JPEG, RESIZE_BILINEAR } = lib.jimp
const jimp = await read(bufferOrFilePath as any)
const min = Math.min(jimp.getWidth(), jimp.getHeight())