Personal Website for @jaspermayone.com jaspermayone.com
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

build?

-5
-5
src/pages/api/photos/metadata/[filename].tsx
··· 1 1 import { NextApiRequest, NextApiResponse } from "next"; 2 2 import fs from "fs"; 3 3 import path from "path"; 4 - import sharp from "sharp"; 5 4 import { ExifImage } from "exif"; 6 5 7 6 export default async function handler( ··· 22 21 return res.status(404).json({ message: "File not found." }); 23 22 } 24 23 25 - // Get metadata using Sharp 26 - const sharpData = await sharp(filePath).metadata(); 27 - 28 24 // Get EXIF data using ExifImage 29 25 const meta = await new Promise((resolve, reject) => { 30 26 new ExifImage({ image: filePath }, (error, exifData) => { ··· 42 38 43 39 res.status(200).json({ 44 40 file_name: filename, 45 - sharpMetadata: sharpData, 46 41 exifMetadata: meta, 47 42 }); 48 43 } catch (error) {