feat: add exif data to image tags
All checks were successful
Deploy to SFTP Server / build (push) Successful in 5m16s
All checks were successful
Deploy to SFTP Server / build (push) Successful in 5m16s
This commit is contained in:
parent
f55ae8a267
commit
6f433e08ce
@ -47,6 +47,7 @@ const allowedExif = [
|
|||||||
export async function getExifData(image: ImageMetadata) {
|
export async function getExifData(image: ImageMetadata) {
|
||||||
const sharp = await getSharp();
|
const sharp = await getSharp();
|
||||||
if (!sharp) return;
|
if (!sharp) return;
|
||||||
|
try {
|
||||||
const tags = await ExifReader.load((image as ImageMetadata & { fsPath: string }).fsPath, { async: true });
|
const tags = await ExifReader.load((image as ImageMetadata & { fsPath: string }).fsPath, { async: true });
|
||||||
|
|
||||||
const out: Record<string, any> = {};
|
const out: Record<string, any> = {};
|
||||||
@ -59,4 +60,10 @@ export async function getExifData(image: ImageMetadata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return hasExif ? out : undefined;
|
return hasExif ? out : undefined;
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
console.log("Error reading EXIF data", error);
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user