Skip to content

fix(design): fit card images without cropping - #66

Merged
plainprogrammer merged 19 commits into
mainfrom
019-uncropped-card-images
Oct 12, 2026
Merged

plainprogrammer merged 19 commits into
mainfrom
019-uncropped-card-images

Conversation

@plainprogrammer

Copy link
Copy Markdown
Owner

Card images are now always shown whole and in their own proportions, in tiles, on the card page and in the table thumbnail. Closes #35.

Why

Scryfall's image guidelines say not to crop, clip or stretch card images (research 016, sections 4 and 7). The exported design system fitted tile and card page images with object-fit: cover, which crops whenever an image isn't exactly 63:88, and the table thumbnail had no fitting rule, so it stretched its image. Measured in the suite's browser before the fix, a Scryfall-sized image (488×680) lost 0.19px from each side in a tile and was drawn 1.67% too tall in the thumbnail.

What changed

  • One block in collector/additions.css (Image fit (spec 019)), three rules:
    • tiles and the card page use contain, so the whole image sits inside its 63:88 slot and any leftover shows surface-sunken;
    • the thumbnail's image takes its height from 63:88 of its 24px width (24×33.52, the empty thumbnail's size, where it was 24×34) and uses contain;
    • the card page's slot is positioned, so a face's missing-image fallback stays in its own slot. Before, it was placed against the whole image column and, for a card with one face's image missing, lay over the other face's image.
  • components.css and tokens.css are untouched. The override lives in additions.css, which a re-export doesn't replace, and is documented as the ImageFit pattern (docs/design-system/components/ImageFit.md, one README line) for upstreaming.
  • No view changes.
  • 14 new examples. Eleven run in headless Firefox with pictures that are deliberately not 63:88 and read back where the browser paints them; they fail if a re-export brings cropping or stretching back. Test pictures arrive as data: addresses, so the suite's browser asks no catalog source for anything.

One visible side effect: a table row with an image is half a pixel shorter (53px to 52.52px), so it now matches a row without one.

Documents

  • Spec (v1.3.0)
  • Plan
  • Verification: each criterion and the example that holds it, the thumbnail measured before and after, and the review's result

Checks

  • bin/ci on this commit: 453 files with no RuboCop offenses, 0 Brakeman warnings, 1133 examples, 0 failures, 1 pending (the pending example needs COLLECTOR_ART_AGREEMENT).
  • A read-only implementation review against the spec returned spec-aligned.

Still owed

  • Phone check (WebKit). On your phone, from a dev server on this branch, open the collection grid, the table and a card page, and confirm the images are whole and the thumbnails aren't stretched. Real Scryfall images are within 0.3% of 63:88, so this checks that nothing regressed rather than showing a visible difference.
  • Session wrap for this branch.

Not asserted by any example: a failed image's alternative text, which is the browser's own rendering.

Out of scope

Merging alongside the spec 018 PR

Spec 018 (#34) edits the same three files: collector/additions.css, docs/design-system/README.md and spec/design_system_files_spec.rb. This PR's CSS block is mid-file and its examples are in a describe of their own, to keep the overlap small. Whichever PR merges second should still expect conflicts on adjacent lines, most likely the new README line and the end of the spec file. Keep both sides, with the README lines in spec order.

Screenshots

The pictures are test images that are deliberately square, tall and wide, so the fit is visible.

Collection grid, 1280px

Grid, light
Grid, dark

Collection table, 1280px

Table, light
Table, dark

Card page, 1280px

Card page, light
Card page, dark

At 390px

Grid, light Grid, dark Table, light Table, dark
Card page, light Card page, dark

🤖 Generated with Claude Code

@plainprogrammer
plainprogrammer marked this pull request as ready for review October 12, 2026 14:15
plainprogrammer and others added 19 commits October 12, 2026 15:14
Refs #35.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thumbnail size exception in FR-2, how the browser gets test images,
AC-1.4 as a markup check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The maintainer ruled that the table thumbnail keeps its 2px corner as
exported. No open questions remain in the spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The maintainer ruled that the card page's missing-image fallback is put
inside its own slot here. Planning measured each slot in the browser:
the thumbnail stretch is real (24x34 against 24x33.52), and one device
pixel is too loose a tolerance to see it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Six phases: test pictures in the browser, tiles and the card page, the
table thumbnail (measured before and after), the card page's fallback,
the pattern doc, and verification. Every block was run red and green in
this worktree before the plan was written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Phase 0: Test pictures in the browser (spec 019).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Phase 1: Tiles and the card page show the whole image (spec 019).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Phase 2: The table thumbnail isn't stretched (spec 019).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Phase 2: The table thumbnail isn't stretched (spec 019).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Phase 3: The card page's fallback sits in its own slot (spec 019).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Phase 4: The design system documents the override (spec 019).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Phase 5: Integration Verification (spec 019). Grid, table and card page
with pictures that aren't 63:88, at 1280px and 390px, light and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 5: Integration Verification (spec 019).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…019)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two new memories (browser spec gotchas for images and windows, spec 019
follow-ups) and additions to two existing ones (exact plans without a
prototype branch, the pre-push gate).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@plainprogrammer
plainprogrammer force-pushed the 019-uncropped-card-images branch from fad446f to 1f42824 Compare October 12, 2026 19:41
@plainprogrammer plainprogrammer self-assigned this Oct 12, 2026
@plainprogrammer
plainprogrammer merged commit 3a8326a into main Oct 12, 2026
4 checks passed
@plainprogrammer
plainprogrammer deleted the 019-uncropped-card-images branch October 12, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fit card images without cropping

1 participant