Files
rentall-app/lambdas/imageProcessor
jackiettran 5d3c124d3e text changes
2026-01-21 19:20:07 -05:00
..
2026-01-14 12:11:50 -05:00
2026-01-14 12:11:50 -05:00
2026-01-21 19:20:07 -05:00
2026-01-21 19:20:07 -05:00
2026-01-14 12:11:50 -05:00
2026-01-21 17:48:50 -05:00
2026-01-21 19:20:07 -05:00

Image Processor Lambda

Processes uploaded images by extracting metadata (EXIF, GPS, camera info) and stripping it before storing publicly. Triggered by S3 uploads to the staging/ prefix.

How It Works

  1. User uploads image to staging/{folder}/{uuid}.jpg via presigned URL
  2. S3 triggers this Lambda
  3. Lambda extracts metadata and saves to ImageMetadata table
  4. Lambda strips EXIF data from image
  5. Lambda moves clean image to final location {folder}/{uuid}.jpg
  6. Lambda deletes staging file

Local Development

Install Dependencies

cd lambdas/shared && npm install
cd ../imageProcessor && npm install

Run Locally

aws s3 cp source s3://bucket-name/staging/image-type/key --profile your-profile-name
npm run local -- staging/items/test-image.jpg my-bucket

Run Migration

cd backend
npx sequelize-cli db:migrate

Supported Image Types

  • JPEG (.jpg, .jpeg)
  • PNG (.png)
  • GIF (.gif) - preserves animation
  • WebP (.webp)

Metadata Extracted

Field Description
latitude, longitude GPS coordinates (stripped from public image)
cameraMake, cameraModel Camera manufacturer and model
cameraSoftware Software used to create image
dateTaken Original capture date
width, height Image dimensions
orientation EXIF orientation flag
fileSize File size in bytes

Deployment

See infrastructure/cdk/README.md for deployment instructions.

cd infrastructure/cdk
npm run deploy:staging