From f8925855f0c0939a3e9c02f7bf41d465443d6cc6 Mon Sep 17 00:00:00 2001 From: "joe.lapp" Date: Thu, 15 Sep 2005 05:55:16 +0200 Subject: made tpl_img() arguments more intuitive Caller passes non-zero dimension only when proportionately limiting the image by that dimension; no need to pass very large numbers to preserve the image's original dimensions or to leave one dimension unconstrained. darcs-hash:20050915035516-36b45-660f49670164c75285cf3e9051d10786216ec6df.gz --- inc/template.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/template.php b/inc/template.php index 20d42a7a4..8545b4313 100644 --- a/inc/template.php +++ b/inc/template.php @@ -857,7 +857,7 @@ function tpl_img_getTag($tags,$alt=''){ * * Only allowed in: detail.php */ -function tpl_img($maxwidth=900,$maxheight=700){ +function tpl_img($maxwidth=0,$maxheight=0){ global $IMG; $w = tpl_img_getTag('File.Width'); $h = tpl_img_getTag('File.Height'); @@ -865,15 +865,15 @@ function tpl_img($maxwidth=900,$maxheight=700){ //resize to given max values $ratio = 1; if($w >= $h){ - if($w >= $maxwidth){ + if($maxwidth && $w >= $maxwidth){ $ratio = $maxwidth/$w; - }elseif($h > $maxheight){ + }elseif($maxheight && $h > $maxheight){ $ratio = $maxheight/$h; } }else{ - if($h >= $maxheight){ + if($maxheight && $h >= $maxheight){ $ratio = $maxheight/$h; - }elseif($w > $maxwidth){ + }elseif($maxwidth && $w > $maxwidth){ $ratio = $maxwidth/$w; } } -- cgit v1.2.3