feat(media): flow_diagram renders 16:9 by default, scales to fit#2900
Merged
Conversation
The template previously sized the canvas to content, producing a thin banner that's awkward as a featured image. It now renders onto a fixed target canvas (default: 16:9 twitter_card 1200x675) and centers the diagram within it, scaling the grid down uniformly to fit. Callers can override with 'preset' or explicit width/height; very wide flows still grow the canvas rather than clip. Smoke test extended to assert the 16:9 default and preset override.
dca15be to
c8a2750
Compare
Contributor
Homeboy Results —
|
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.
Summary
flow_diagramtemplate used to size its canvas to content, producing a thin banner that's awkward as a blog featured image or social share.twitter_card, 1200x675).preset(any PlatformPresets key) or explicitwidth/height. Very wide horizontal flows grow the canvas rather than clip.Why
A generic diagram primitive should produce a correctly-proportioned image out of the box, not a strip you have to pad by hand. 16:9 is the sensible default for the most common use (featured images, social cards).
Test plan
preset=open_graphoverride yields 1200x630. 15/15 assertions pass locally on PHP 8.3.6.Notes
resolve_canvas()precedence: explicit width/height → preset → default preset.floor()on scaled metrics so scaled content never overflows the target by a rounding pixel (canvas dimensions stay exact).