Fix jimp type check from 'object' to 'function' (#2034)

Fixes the error “No image processing library is available.” even when Jimp is installed.

In recent versions of Jimp, Jimp is now defined as a class instead of an object, which breaks the existing type check.



*Idk if this is useless/useful
This commit is contained in:
Muhammad Restu
2025-11-19 20:17:59 +07:00
committed by GitHub
parent 40f128d88a
commit 0145e4c710
+1 -1
View File
@@ -199,7 +199,7 @@ export const generateProfilePicture = async (
quality: 50
})
.toBuffer()
} else if ('jimp' in lib && typeof lib.jimp?.Jimp === 'object') {
} else if ('jimp' in lib && typeof lib.jimp?.Jimp === 'function') {
const jimp = await (lib.jimp.Jimp as any).read(buffer)
const min = Math.min(jimp.width, jimp.height)
const cropped = jimp.crop({ x: 0, y: 0, w: min, h: min })