diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php index f3ee97b912f1fad3b3785c96113716a80ed21515..656e986257994690822e6cab6912421fae8c7479 100644 --- a/inc/JpegMeta.php +++ b/inc/JpegMeta.php @@ -431,7 +431,8 @@ class JpegMeta 'Iptc.Caption', 'Exif.UserComment', 'Exif.TIFFUserComment', - 'Exif.TIFFImageDescription')); + 'Exif.TIFFImageDescription', + 'File.Name')); if (empty($cap)) return false; if(!$max) return $cap; diff --git a/inc/common.php b/inc/common.php index f40c8f1fd3e854984efc10df110da069d7752070..eadef5767226c882108bd3cba5c93b7b47699679 100644 --- a/inc/common.php +++ b/inc/common.php @@ -76,6 +76,40 @@ function pageinfo(){ return $info; } +/** + * Build an string of URL parameters + * + * @author Andreas Gohr + */ +function buildURLparams($params){ + $url = ''; + $amp = false; + foreach($params as $key => $val){ + if($amp) $url .= '&'; + + $url .= $key.'='; + $url .= urlencode($val); + $amp = true; + } + return $url; +} + +/** + * Build an string of html tag attributes + * + * @author Andreas Gohr + */ +function buildAttributes($params){ + $url = ''; + foreach($params as $key => $val){ + $url .= $key.'="'; + $url .= htmlspecialchars ($val); + $url .= '" '; + } + return $url; +} + + /** * print a message * diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index b633260aced6b5149caae2306808efc742cd4387..81f0b2dcaf64c201432bd1e36cb7309c6131252a 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -708,7 +708,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['title'] = $this->_xmlEntities($src); list($ext,$mime) = mimetype($src); - if(substr($mime,0,5) == 'image'){ + if(substr($mime,0,5) == 'image' && !preg_match('#^(https?|ftp)://#i',$src)){ $link['url']= DOKU_BASE.'lib/exe/detail.php?id='.$ID.'&cache='.$cache.'&media='.urlencode($src); }else{ $link['url']= DOKU_BASE.'lib/exe/fetch.php?cache='.$cache.'&media='.urlencode($src); diff --git a/inc/template.php b/inc/template.php index d9b0454f1117290a33ca39902495b4c145e9fdba..3a86930be7f27c8154d56cfdc43b99f1ed3b33fd 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>'; }