feat: improve some error messages
All checks were successful
Deploy to SFTP Server / build (push) Successful in 4m6s
All checks were successful
Deploy to SFTP Server / build (push) Successful in 4m6s
This commit is contained in:
@ -9,7 +9,7 @@ async function getSharp(): Promise<typeof import("sharp") | undefined> {
|
||||
return s;
|
||||
}
|
||||
|
||||
export async function generateThumbHash(image: ImageMetadata) {
|
||||
export async function generateThumbHash(image: ImageMetadata & { fsPath?: string }) {
|
||||
|
||||
const sharp = await getSharp();
|
||||
if (!sharp) return;
|
||||
@ -20,7 +20,6 @@ export async function generateThumbHash(image: ImageMetadata) {
|
||||
const smallHeight = Math.floor(image.height * scaleFactor);
|
||||
|
||||
try {
|
||||
//@ts-ignore
|
||||
const smallImg = await sharp(image.fsPath)
|
||||
.resize(smallWidth, smallHeight)
|
||||
.withMetadata()
|
||||
@ -31,9 +30,8 @@ export async function generateThumbHash(image: ImageMetadata) {
|
||||
const buffer = rgbaToThumbHash(smallWidth, smallHeight, smallImg);
|
||||
return Buffer.from(buffer).toString("base64");
|
||||
} catch (error) {
|
||||
//@ts-ignore
|
||||
console.log(`Could not generate thumbhash for ${image.fsPath}`, error)
|
||||
return undefined
|
||||
return ""
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user