Skip to content

feat(assets): compress oversized team photos before blob migration #41

@wab

Description

@wab

This was generated by AI during triage.

Parent

#32

Problem

The 11 active team photos in posts/assets/team/*.{jpg,jpeg} total ~30 MB on disk. 7 of them are above 2 MB, with damien-robert.jpg at 7.6 MB, mariette-baudras.jpg at 4.4 MB, louis-strauss.jpg at 3.5 MB. These are unoptimised originals at full camera resolution — many multiples of what any web layout actually displays.

Migrating them as-is means: paying for 30 MB of Vercel Blob storage forever, pushing all those bytes through bandwidth, and degrading LCP on every page that loads a team member avatar.

Doing this before #36 (push to new store) avoids re-doing the upload.

What to build

posts/scripts/compress-team-photos.js:

  • Reads posts/assets/team/*.{jpg,jpeg}, filters to files above a configurable threshold (default 400 KB).
  • For each over-threshold file: resize to fit within 800x800, re-encode as JPEG quality 80, preserve original filename + extension.
  • Dry-run by default: prints before → after (saved X%) for each candidate, no writes.
  • --write flag executes the in-place compression.
  • Summary at the end: total before, total after, total saved.

Tooling: sharp is the cleanest choice on Node — already widely used in the Vercel stack. Add as a devDependency.

After human review of dry-run output + a visual smoke test on 2–3 photos at the new resolution, run --write and commit with a chore(assets): compress team photos conventional commit.

Acceptance criteria

  • posts/scripts/compress-team-photos.js exists, dry-run by default
  • --write performs in-place compression
  • All files in posts/assets/team/ are ≤ 400 KB after compression
  • All dimensions ≤ 800x800
  • Total posts/assets/team/ size reduced by at least 80%
  • Visual smoke check on 3 photos (HITL gate — maintainer confirms quality acceptable)
  • Compression committed atomically

Blocks

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentScoped, dependencies clear, acceptance criteria explicit — grabbable by an AFK agent

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions