Skip to content

Commit

Permalink
fix: keep metadata for photos
Browse files Browse the repository at this point in the history
  • Loading branch information
limulus committed Nov 28, 2024
1 parent a0cf31b commit 536ed67
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 225 deletions.
18 changes: 9 additions & 9 deletions bin/process-photos.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import sharp from 'sharp'
const baseUrl = `https://pho.limulus.net`

const presets = [
{ name: 'xl', width: null, format: 'avif' },
{ name: 'xl', width: null, format: 'jpeg' },
{ name: 'lg', width: 3000, format: 'avif' },
{ name: 'lg', width: 3000, format: 'jpeg' },
{ name: 'md', width: 1500, format: 'avif' },
{ name: 'md', width: 1500, format: 'jpeg' },
{ name: 'sm', width: 750, format: 'avif' },
{ name: 'sm', width: 750, format: 'jpeg' },
{ name: 'xl', width: null, format: 'avif', keepMeta: true },
{ name: 'xl', width: null, format: 'jpeg', keepMeta: true },
{ name: 'lg', width: 3000, format: 'avif', keepMeta: true },
{ name: 'lg', width: 3000, format: 'jpeg', keepMeta: true },
{ name: 'md', width: 1500, format: 'avif', keepMeta: true },
{ name: 'md', width: 1500, format: 'jpeg', keepMeta: true },
{ name: 'sm', width: 750, format: 'avif', keepMeta: false },
{ name: 'sm', width: 750, format: 'jpeg', keepMeta: false },
]

const files = process.argv.slice(2)
Expand Down Expand Up @@ -111,7 +111,7 @@ async function processFile(file) {

uploadQueue.write({ id, name: original, file })

const photo = sharp(file)
const photo = sharp(file).keepMetadata()
const [meta, { width, height }] = await Promise.all([
ExifReader.load(file, { expanded: true }),
photo.metadata(),
Expand Down
Loading

0 comments on commit 536ed67

Please sign in to comment.