Let a project say which edge of its image to keep when cropped - #4
Merged
Merged
Conversation
The marquee squares off a landscape screenshot, and a centre crop of the What's the Point launcher throws away the half that identifies it: the wordmark and the call to action sit on the left, and what survives is empty background and a few playing cards. Projects gain an optional `imageAnchor`, one of the nine usual positions, defaulting to centre so nothing else moves. The anchor has to be spelled twice because the two call sites are cropped by different things. The projects page takes the image whole and lets `object-cover` crop it in the browser, which `object-left` steers. The marquee asks @nuxt/image for a 234px square and gets one back already cropped, server-side, where CSS never gets a say — that one needs the position handed to the resize. The first version of this only did the former and changed nothing on the page that prompted it. Corners map to sharp's compass names rather than its `left top` spelling because the modifier ends up in a URL and IPX answers 500 to the space. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHZiNTwwiniSxbBr9BQdEw
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Follow-up to #2, which merged before this landed on it.
The marquee squares off a landscape screenshot, and a centre crop of the What's the Point launcher throws away the half that identifies it: the wordmark and the call to action sit on the left, so what survives is empty background and a few playing cards.
Projects gain an optional
imageAnchor— one of the nine usual positions, defaulting tocenter, so nothing else moves. What's the Point is set toleft.The anchor has to be spelled twice
The two call sites are cropped by different things:
/projectscard/_ipx/_/…),object-covercrops itobject-leftclass@nuxt/image— a 234px square comes back already cropped, server-sidepositionmodifier on the resizeCSS never gets a say in the second case, because the image arrives square. The first version of this change only added the class, verified
object-position: 0% 50%was applied, and changed nothing on the page that prompted it — worth knowing if this ever needs revisiting.Both forms come from one authored value via
app/utils/projectImage.ts, which is also the source of truth for the Zod enum incontent.config.ts.Corners use compass names
imageAnchor: top-leftmaps to sharp'snorthwestrather than itsleft topspelling. The modifier ends up in a URL, and IPX answers 500 to the space:All nine values were checked against the running server.
Verification
Built and served the production output, then drove both pages in Chromium.
pos_left, on both the 1x and 2x srcset entries (/_ipx/pos_left&s_234x234/…). The other three projects are untouched.object-lefton What's the Point,object-centeron the rest. The card renders identically to before — the crop there is vertical, so a horizontal anchor is correctly a no-op.npx eslint .reports the same 40 errors / 1 warning asmaster— all inapp/app.vueandapp/pages/about.vue, neither touched here.Generated by Claude Code