From be0fbb27bc0a015860a309654de285553e2861cb Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Fri, 5 Jun 2026 12:19:26 +0100 Subject: Support explicit width/height params in biticon SVG output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- smartyplugins/function.biticon.php | 7 ++++--- 1 file 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 .= " />"; -- cgit v1.3