Skip to content

Include renditions in the gallery responses - #241

Merged
ssavutu merged 2 commits into
mainfrom
feat/gallery-variants
Oct 1, 2026
Merged

ssavutu merged 2 commits into
mainfrom
feat/gallery-variants

Conversation

@ssavutu

@ssavutu ssavutu commented Oct 1, 2026

Copy link
Copy Markdown
Member

Why

GET /v1/gallery (the public /photo page) and the editor's gallery view each build their own MediaOverview items, so neither picked up the variants that models.Media gained in #239. Every tile on /photo loads a full camera original in a 2–4 column grid, which makes it the heaviest page per image on the site.

Change

  • MediaOverview gains variants (omitempty), filled from the same in-memory index as everything else. No extra queries.
  • Set in both gallery handlers.

Verified

  • New TestMediaHTTP_PublicGalleryCarriesVariants installs a fake rendition lookup, curates an upload, and checks that /v1/gallery returns its variants. All MediaHTTP integration tests pass against MariaDB 11.7.
  • go test -race ./... and go vet ./... pass. Swagger is regenerated.

Merge order

Stacked on #240 to avoid Swagger conflicts, so it targets that branch. Merge #240 first; GitHub retargets this to main. The Scalene side is a separate PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_019EcFyy8aqNnUd75CDPY6Bx

ssavutu and others added 2 commits September 30, 2026 23:12
Article pages still load full-size originals. The lead photo is almost
always inline in the body rather than in featured_image: the CMS editor
inserts it there, and WordPress did too. All 30 of the latest articles do
this. featured_image_variants therefore never reaches it.

The article detail now carries content_image_variants: renditions for each
inline <img>, keyed by the wp-content path exactly as the body references
it. About half of those references are WordPress resized copies
(photo-1024x683.jpg). These resolve to the original's renditions, but only
when the aspect ratio matches within 2%, so a square-cropped thumbnail is
never replaced with the uncropped photo.

The lookup is served from the same in-memory index, so it adds no queries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019EcFyy8aqNnUd75CDPY6Bx
The public photo gallery (/v1/gallery) and the editor's gallery view
assemble their own MediaOverview items, so neither carried the renditions
that media items now have. Every gallery tile therefore loaded a full camera
original, making /photo the heaviest page per image on the site.

MediaOverview now has variants, filled from the same in-memory index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019EcFyy8aqNnUd75CDPY6Bx
@ssavutu
ssavutu changed the base branch from feat/content-image-variants to main October 1, 2026 03:24
@ssavutu ssavutu closed this Oct 1, 2026
@ssavutu ssavutu reopened this Oct 1, 2026
@ssavutu
ssavutu merged commit f055b96 into main Oct 1, 2026
7 checks passed
@ssavutu
ssavutu deleted the feat/gallery-variants branch October 1, 2026 03:27
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