Skip to content

BeechCMS


BeechCMS / @beechcms/core / deriveScaleOutput

Function: deriveScaleOutput() ​

deriveScaleOutput(presetWidth, source, maxDimension): MediaDimensions | null

Output dimensions of a scale preset (fit=scale-down: never upscales). Returns null when either side would exceed maxDimension — the pathological-aspect-ratio guard of brief §4. Never truncates.

Parameters ​

presetWidth ​

number

source ​

MediaDimensions

maxDimension ​

number

Returns ​

MediaDimensions | null