chore: pnpm up
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user