VectorImageMedium::__construct() falls back to the viewBox with [,$width,$height,] = $size;, which takes min-y and width (indexes 1–2) rather than width and height (2–3).
Repro on 2.2.4 (the same code is on 2.0 and develop): put an SVG with only a viewBox in a page folder and read page.media['a.svg'].get('width').
viewBox="0 0 120 40" gives no width or height (expected 120 × 40): min-y "0" fails the $width && $height check.
viewBox="0 10 200 100" gives 10 × 200.
Fix: [, , $width, $height] = $size;. Splitting on /[\s,]+/ instead of ' ' would also accept comma-separated viewBoxes, which SVG allows.
Related: the (int) cast reads width="100%" as 100.
VectorImageMedium::__construct()falls back to the viewBox with[,$width,$height,] = $size;, which takes min-y and width (indexes 1–2) rather than width and height (2–3).Repro on 2.2.4 (the same code is on
2.0anddevelop): put an SVG with only a viewBox in a page folder and readpage.media['a.svg'].get('width').viewBox="0 0 120 40"gives no width or height (expected 120 × 40): min-y"0"fails the$width && $heightcheck.viewBox="0 10 200 100"gives 10 × 200.Fix:
[, , $width, $height] = $size;. Splitting on/[\s,]+/instead of' 'would also accept comma-separated viewBoxes, which SVG allows.Related: the
(int)cast readswidth="100%"as 100.