diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-05 12:19:26 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-05 12:19:26 +0100 |
| commit | be0fbb27bc0a015860a309654de285553e2861cb (patch) | |
| tree | 5002075b73f498395248be3e4a79bd67ddec65ff /smartyplugins | |
| parent | b7499cdda11e87e89957639b6aaf93fba47d5043 (diff) | |
| download | themes-be0fbb27bc0a015860a309654de285553e2861cb.tar.gz themes-be0fbb27bc0a015860a309654de285553e2861cb.tar.bz2 themes-be0fbb27bc0a015860a309654de285553e2861cb.zip | |
Support explicit width/height params in biticon SVG output
Add width/height to omit list so they don't double-output; SVG size code
now uses them if provided, falling back to svgSizes[isize] for square icons.
Allows flag icons to be rendered at 32×24 (4:3) rather than forced square.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'smartyplugins')
| -rwxr-xr-x | smartyplugins/function.biticon.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/smartyplugins/function.biticon.php b/smartyplugins/function.biticon.php index a6422b1..d866e70 100755 --- a/smartyplugins/function.biticon.php +++ b/smartyplugins/function.biticon.php @@ -61,7 +61,7 @@ function biticon_output( $pParams, $pFile ) { $outstr .= ' alt=""'; } - $ommit = [ 'ilocation', 'ipackage', 'ipath', 'iname', 'iexplain', 'iforce', 'istyle', 'iclass', 'isize' ]; + $ommit = [ 'ilocation', 'ipackage', 'ipath', 'iname', 'iexplain', 'iforce', 'istyle', 'iclass', 'isize', 'width', 'height' ]; foreach( $pParams as $name => $val ) { if( !in_array( $name, $ommit ) ) { $outstr .= ' '.$name.'="'.$val.'"'; @@ -80,8 +80,9 @@ function biticon_output( $pParams, $pFile ) { if( str_ends_with( $pFile, '.svg' ) ) { $svgSizes = ['small' => 16, 'medium' => 24, 'large' => 32]; - $px = $svgSizes[$pParams['isize'] ?? 'small'] ?? 16; - $outstr .= " width=\"$px\" height=\"$px\""; + $w = $pParams['width'] ?? ($svgSizes[$pParams['isize'] ?? 'small'] ?? 16); + $h = $pParams['height'] ?? $w; + $outstr .= " width=\"$w\" height=\"$h\""; } $outstr .= " />"; |
