Skip to content

fix(studio): gallery thumbnails show true aspect ratio (#706) - #712

Open
mcarlson wants to merge 1 commit into
stagefrom
feat/706-gallery-aspect-ratio
Open

fix(studio): gallery thumbnails show true aspect ratio (#706)#712
mcarlson wants to merge 1 commit into
stagefrom
feat/706-gallery-aspect-ratio

Conversation

@mcarlson

@mcarlson mcarlson commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Closes #706

Problem

In the studio still-image gallery, every thumbnail rendered as the same fixed box — ImageCard hard-coded aspect-ratio: 16 / 9 and ImageThumbnail used object-fit: cover. Portrait and square images were force-cropped (tops/bottoms cut off).

Fix

The image now drives the card's height, so each thumbnail shows its true aspect ratio:

  • ImageThumbnail: height: 100%; object-fit: coverdisplay: block; width: 100%; height: auto;
  • ImageCard: drop the fixed aspect-ratio: 16 / 9; add a $ratio prop applied only to image-less placeholders (queue / failed) so they don't collapse
  • ImageGrid: align-items: start so a short card isn't stretched to its row's tallest neighbour
  • New pure helper aspectRatioFromSize() (derives the placeholder box from a generated image's size), TDD'd in size-options.test.ts

No cropping anywhere; works uniformly for generated, uploaded, and playlist images. The lightbox (already object-fit: contain) is unaffected.

Verification

  • Confirmed against staging that thumbnails preserve source aspect ratio (a 1392×752 image's thumbnail is 1392×752, not squared), so height: auto genuinely shows the real shape.
  • Rendered real portrait / square / landscape staging thumbnails through the exact gallery CSS (before vs after).
  • pnpm type-check, eslint, and size-options unit tests pass.

Demo

Before → after (portrait lighthouse + square mandala cropped into 16:9 boxes, then shown full at true aspect):
https://drive.google.com/file/d/1HozD-aHnc10_rGsmCSRL23_vkYjT0--7/view?usp=sharing

#712

Still-image gallery cards hard-coded aspect-ratio 16/9 with object-fit:cover,
cropping every thumbnail into the same box. Now the image drives the card
height (width:100%, height:auto) so portrait/square/landscape render true.

- ImageThumbnail: object-fit:cover/height:100% -> display:block, height:auto
- ImageCard: drop fixed 16/9; add $ratio applied only to image-less
  placeholders (queue/failed) so they don't collapse
- ImageGrid: align-items:start so short cards aren't stretched
- add pure aspectRatioFromSize() helper (from generated image size), TDD'd

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying frontend-alpha with  Cloudflare Pages  Cloudflare Pages

Latest commit: f1faa76
Status: ✅  Deploy successful!
Preview URL: https://1fbb50fe.frontend-btm.pages.dev
Branch Preview URL: https://feat-706-gallery-aspect-rati.frontend-btm.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying frontend-stage with  Cloudflare Pages  Cloudflare Pages

Latest commit: f1faa76
Status: ✅  Deploy successful!
Preview URL: https://931542fe.frontend-d7v.pages.dev
Branch Preview URL: https://feat-706-gallery-aspect-rati.frontend-d7v.pages.dev

View logs

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.

1 participant