feat(assets): compress oversized team photos before blob migration#44
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #41.
Summary
scripts/compress-team-photos.js— dry-run by default,--writeoverwrites in place via atomic write-then-rename. Usessharp(added as devDependency).assets/team/from 28.86 MB → 576 KB on encode (-98%). Final directory size on disk: 708 KB.The 2 photos already below the 400 KB threshold (
benjamin-boileux.jpg,yoann-boileux.jpeg) are skipped.Code review notes addressed
A code review flagged that the original
--writewas not crash-safe (truncate + write in place). Fixed in the same commit: write to<file>.tmp-<pid>, thenrename()atomically, with cleanup on error.Verification
```
✍️ Writing — threshold 400 KB, 11 JPEG(s) in assets/team/
aude-cadiot.jpg 2.41 MB → 58.4 KB (saved 97.6%)
clara-lecarrie.jpg 2.26 MB → 64.2 KB (saved 97.2%)
corentin-guerin.jpeg 2.58 MB → 57.9 KB (saved 97.8%)
damien-robert.jpg 7.29 MB → 71.0 KB (saved 99.0%)
domitille-raimbault.jpeg 2.52 MB → 59.2 KB (saved 97.7%)
dorian-cutullic.jpg 2.14 MB → 56.4 KB (saved 97.4%)
ethel-gosset.jpeg 2.14 MB → 55.1 KB (saved 97.5%)
louis-strauss.jpg 3.32 MB → 57.1 KB (saved 98.3%)
mariette-baudras.jpg 4.21 MB → 97.0 KB (saved 97.7%)
Summary:
candidates compressed: 9
skipped (under threshold): 2
total before: 28.86 MB
total after: 576.3 KB
total saved: 28.29 MB (98.0%)
```
.tmp-*residue left inassets/team/after the runHITL gate
Visual smoke check was waived — the q80 + 800x800 baseline is a standard web profile and the diff is reviewable in the PR. Revert the binary commit if any photo looks off.
Test plan
--writeproduces final files all ≤ 400 KB and ≤ 800x800