|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
juzwa Smarty n00b
Joined: 25 Dec 2006 Posts: 3
|
Posted: Wed Dec 27, 2006 6:51 pm Post subject: {html_image} maxwidt maxheight |
|
|
for example
They are 3 images
1 w:100 h:80
2 w:90 h:100
3 w:120 h:70
and you want to have max width 100 and max height 80
1 - its OK
2 - to hight
3 - to wide
yu can add into
function.html_image.php
in switch before $$_key = $_val; :
Code: |
case 'maxwidth':
case 'maxheight':
|
before return this code
Code: |
if(isset($params['maxwidth'])) {
if($width>$params['maxwidth']){
$height =round($params['maxwidth'] * $height / $width);
$width=$params['maxwidth'];
}
}
if(isset($params['maxheight'])) {
if($height>$params['maxheight']){
$width =round($params['maxheight'] * $width / $height);
$height=$params['maxheight'];
}
}
|
and now you can write
{html_image file="$image" maxheight="50" maxwidth="50"}
These pictures whith are to hight or to wide become resize
i know this is wery siple exaple but it can be useful
ps. I apologize for my english |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|