Fix news detail crop aspect mismatch (clipped heads) + guard test#1424
Merged
Conversation
The news detail page rendered the featured image at 750x350 (15:7) while NewsItem.cropping is locked to a 5:3 crop box (NEWS_THUMBNAIL_SIZE 500x300). easy_thumbnails applied the editor's 5:3 box and THEN a second center-crop to force 15:7, silently trimming the top/bottom of the chosen crop -- clipping people's heads. The admin preview only ever shows the 5:3 box, so the bug was invisible to editors. Render at 750x450 (5:3) so the published image exactly matches the admin crop preview (WYSIWYG). Add test_news_crop_aspect.py, which scans the templates and fails if any crop-enabled on-page news render uses a size whose aspect ratio doesn't match the crop editor's; the OG social card (1200x630) and round 50x50 sidebar chip are documented, intentional exceptions. Version bump deferred (2.26.1 draft was behind current master 2.27.2). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jonfroehlich
added a commit
that referenced
this pull request
Jul 23, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What & why
The news detail page rendered the featured image at
750x350(15:7) whileNewsItem.croppingis locked to a 5:3 crop box (NEWS_THUMBNAIL_SIZE500x300). easy_thumbnails applied the editor's 5:3 box and then a second center-crop to force 15:7 — silently trimming the top/bottom of the chosen crop and clipping people's heads. The admin Cropper.js preview only ever shows the 5:3 box, so the bug was invisible to editors.Reported 2026-07-01 (McDevitt civics photo). This has been live on prod the whole time — the fix was written weeks ago but never actually committed (it was sitting as uncommitted changes in a worktree; discovered during branch cleanup).
Fix
news_item.html: detail render750x350→750x450(5:3), so the published image exactly matches the admin crop preview (WYSIWYG). No model change, no re-cropping — all existing crops become correct immediately. Kept 5:3 (not 16:9, which is wider and would clip people-photos more).test_news_crop_aspect.py: scans templates and fails if any crop-enabled on-page news render uses a size whose aspect ratio differs from the crop editor's. OG social card (1200x630) and the round 50x50 sidebar chip are documented, intentional exceptions.Known latent (out of scope, documented in the test)
project.htmlrelated-project thumb renders160x90(16:9) against a 5:3 Project crop — same class of bug, left for a future project-page pass.Testing
python manage.py test website.tests.test_news_crop_aspect --settings=makeabilitylab.settings_test→ 2 passed (ran in a one-off container against this branch).Note
Version bump intentionally not included — the original draft (2.26.1) is behind current master (2.27.2). Needs a fresh bump before/at merge.
🤖 Generated with Claude Code