feat: log imagePath when failed to generate Thumbhash
This commit is contained in:
parent
8e293c204d
commit
50ce8b3ff7
@ -9,7 +9,7 @@ async function getSharp(): Promise<typeof import("sharp") | undefined> {
|
||||
return s;
|
||||
}
|
||||
|
||||
export async function generateThumbHash(image: { width: number, height: number }) {
|
||||
export async function generateThumbHash(image: ImageMetadata) {
|
||||
|
||||
const sharp = await getSharp();
|
||||
if (!sharp) return;
|
||||
@ -20,7 +20,6 @@ export async function generateThumbHash(image: { width: number, height: number }
|
||||
const smallHeight = Math.floor(image.height * scaleFactor);
|
||||
|
||||
try {
|
||||
|
||||
//@ts-ignore
|
||||
const smallImg = await sharp(image.fsPath)
|
||||
.resize(smallWidth, smallHeight)
|
||||
@ -32,7 +31,8 @@ export async function generateThumbHash(image: { width: number, height: number }
|
||||
const buffer = rgbaToThumbHash(smallWidth, smallHeight, smallImg);
|
||||
return Buffer.from(buffer).toString("base64");
|
||||
} catch (error) {
|
||||
console.log("Could not generate thumbhash", error)
|
||||
//@ts-ignore
|
||||
console.log(`Could not generate thumbhash for ${image.fsPath}`, error)
|
||||
return undefined
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user