mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-22 09:56:51 +01:00
exif extraction updates
This commit is contained in:
parent
6802bc9e16
commit
d4cd0c23a9
@ -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
|
||||||
|
1
src/@types/node_modules.d.ts
vendored
1
src/@types/node_modules.d.ts
vendored
@ -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' {
|
||||||
|
Loading…
Reference in New Issue
Block a user