diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-05 14:30:32 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-05 14:30:32 +0100 |
| commit | 148083ad66aa306924302f7a07f05f0f2790b09d (patch) | |
| tree | 14782698617a23e082205d661c0150e3fd9770c2 /smartyplugins | |
| parent | be0fbb27bc0a015860a309654de285553e2861cb (diff) | |
| download | themes-148083ad66aa306924302f7a07f05f0f2790b09d.tar.gz themes-148083ad66aa306924302f7a07f05f0f2790b09d.tar.bz2 themes-148083ad66aa306924302f7a07f05f0f2790b09d.zip | |
Add istyle=flag for scalable 4:3 SVG flag sizing
istyle=flag scales height via isize (small=16, medium=24, large=32) and
derives width as (height/3)*4. istyle is already in the cache hash so no
further cache key changes needed. Also reverts width/height from $ommit
so they remain available as pass-through HTML attributes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'smartyplugins')
| -rwxr-xr-x | smartyplugins/function.biticon.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/smartyplugins/function.biticon.php b/smartyplugins/function.biticon.php index d866e70..c5839d3 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', 'width', 'height' ]; + $ommit = [ 'ilocation', 'ipackage', 'ipath', 'iname', 'iexplain', 'iforce', 'istyle', 'iclass', 'isize' ]; foreach( $pParams as $name => $val ) { if( !in_array( $name, $ommit ) ) { $outstr .= ' '.$name.'="'.$val.'"'; @@ -80,8 +80,8 @@ function biticon_output( $pParams, $pFile ) { if( str_ends_with( $pFile, '.svg' ) ) { $svgSizes = ['small' => 16, 'medium' => 24, 'large' => 32]; - $w = $pParams['width'] ?? ($svgSizes[$pParams['isize'] ?? 'small'] ?? 16); - $h = $pParams['height'] ?? $w; + $h = $svgSizes[$pParams['isize'] ?? 'small'] ?? 16; + $w = ($pParams['istyle'] ?? '') === 'flag' ? (int)round( $h * 4 / 3 ) : $h; $outstr .= " width=\"$w\" height=\"$h\""; } |
