diff options
Diffstat (limited to 'inc/template.php')
-rw-r--r-- | inc/template.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/inc/template.php b/inc/template.php index d9b0454f1..3a86930be 100644 --- a/inc/template.php +++ b/inc/template.php @@ -765,15 +765,29 @@ function tpl_img($maxwidth=900,$maxheight=700){ $h = floor($ratio*$h); } - //FIXME add alt attribute, classes - - $url=DOKU_BASE.'lib/exe/fetch.php?cache='.urlencode($_REQUEST['cache']). - '&media='.urlencode($IMG); - + //prepare URL + $p = array(); + $p['cache'] = $_REQUEST['cache']; + $p['media'] = $IMG; + $p = buildURLparams($p); + $url=DOKU_BASE.'lib/exe/fetch.php?'.$p; + + //prepare attributes $alt=tpl_img_getTag('Simple.Title'); + $p = array(); + if($w) $p['width'] = $w; + if($h) $p['height'] = $h; + $p['class'] = 'img_detail'; + if($alt){ + $p['alt'] = $alt; + $p['title'] = $alt; + }else{ + $p['alt'] = ''; + } + $p = buildAttributes($p); print '<a href="'.$url.'">'; - print '<img src="'.$url.'&w='.$w.'&h='.$w.'" width="'.$w.'" height="'.$h.'" />'; + print '<img src="'.$url.'&w='.$w.'&h='.$w.'" '.$p.'/>'; print '</a>'; } |