summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe.lapp <joe.lapp@pobox.com>2005-09-15 05:55:16 +0200
committerjoe.lapp <joe.lapp@pobox.com>2005-09-15 05:55:16 +0200
commitf8925855f0c0939a3e9c02f7bf41d465443d6cc6 (patch)
treedde24b1ed47d602b40825964210dbdefd3e25eb5
parentdc673a5b4730b9b706001e8f06ded3dc9986908c (diff)
downloadrpg-f8925855f0c0939a3e9c02f7bf41d465443d6cc6.tar.gz
rpg-f8925855f0c0939a3e9c02f7bf41d465443d6cc6.tar.bz2
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
-rw-r--r--inc/template.php10
-rw-r--r--lib/tpl/default/detail.php2
2 files changed, 6 insertions, 6 deletions
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;
}
}
diff --git a/lib/tpl/default/detail.php b/lib/tpl/default/detail.php
index 1328b7174..70865c933 100644
--- a/lib/tpl/default/detail.php
+++ b/lib/tpl/default/detail.php
@@ -46,7 +46,7 @@
<h1><?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG))?></h1>
<div class="img_big">
- <?php tpl_img() ?>
+ <?php tpl_img(900,700) ?>
</div>
<div class="img_detail">