1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-22 01:46:51 +01:00

exif extraction updates

This commit is contained in:
Matthias Kretschmann 2023-04-01 15:53:20 +01:00
parent 6802bc9e16
commit d4cd0c23a9
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import type { Actions, Node, NodePluginArgs } from 'gatsby' import type { Actions, Node, NodePluginArgs } from 'gatsby'
import getCoordinates from 'dms2dec' import getCoordinates from 'dms2dec'
import fastExif from 'fast-exif' import { read } from 'fast-exif'
import Fraction from 'fraction.js' import Fraction from 'fraction.js'
import fs from 'fs' import fs from 'fs'
import iptc from 'node-iptc' import iptc from 'node-iptc'
@ -10,9 +10,14 @@ export const createExif = async (
actions: Actions, actions: Actions,
createNodeId: NodePluginArgs['createNodeId'] createNodeId: NodePluginArgs['createNodeId']
) => { ) => {
if (!node?.absolutePath) return
try { try {
// exif // exif
const exifData = await fastExif.read(node.absolutePath, true) const exifData = (await read(
node.absolutePath as string,
true
)) as Queries.ImageExif
if (!exifData) return if (!exifData) return
// iptc // iptc

View File

@ -1,7 +1,6 @@
declare module 'pigeon-maps' declare module 'pigeon-maps'
declare module 'pigeon-marker' declare module 'pigeon-marker'
declare module 'unified' declare module 'unified'
declare module 'fast-exif'
declare module 'node-iptc' declare module 'node-iptc'
declare module 'dms2dec' { declare module 'dms2dec' {