chore: pnpm up

This commit is contained in:
Max Richter
2025-07-20 14:15:44 +02:00
parent 666b618a73
commit f84704d20b
10 changed files with 979 additions and 935 deletions

View File

@ -53,10 +53,15 @@ const allowedExif = [
];
export async function getExifData(image: ImageMetadata) {
if (image.format === "svg") return undefined; // SVGs don't have EXIF data")
const sharp = await getSharp();
if (!sharp) return;
const imagePath = (image as ImageMetadata & { fsPath: string }).fsPath;
try {
const tags = await ExifReader.load((image as ImageMetadata & { fsPath: string }).fsPath, { async: true });
const buffer = await sharp(imagePath).toBuffer();
const tags = await ExifReader.load(buffer, { async: true });
const out: Record<string, any> = {};
let hasExif = false;
@ -70,7 +75,7 @@ export async function getExifData(image: ImageMetadata) {
return hasExif ? out : undefined;
} catch (error) {
console.log("Error reading EXIF data", error);
console.log(`Error reading EXIF data from ${imagePath}`, error);
return undefined
}