Include renditions in the gallery responses - #241
Merged
Merged
Conversation
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
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.
Why
GET /v1/gallery(the public/photopage) and the editor's gallery view each build their ownMediaOverviewitems, so neither picked up thevariantsthatmodels.Mediagained in #239. Every tile on/photoloads a full camera original in a 2–4 column grid, which makes it the heaviest page per image on the site.Change
MediaOverviewgainsvariants(omitempty), filled from the same in-memory index as everything else. No extra queries.Verified
TestMediaHTTP_PublicGalleryCarriesVariantsinstalls a fake rendition lookup, curates an upload, and checks that/v1/galleryreturns its variants. AllMediaHTTPintegration tests pass against MariaDB 11.7.go test -race ./...andgo 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