summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/JpegMeta.php3
-rw-r--r--inc/common.php34
-rw-r--r--inc/parser/xhtml.php2
-rw-r--r--inc/template.php26
4 files changed, 57 insertions, 8 deletions
diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php
index f3ee97b91..656e98625 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 f40c8f1fd..eadef5767 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -77,6 +77,40 @@ function pageinfo(){
}
/**
+ * 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
*
* If HTTP headers were not sent yet the message is added
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index b633260ac..81f0b2dca 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 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.'&amp;w='.$w.'&amp;h='.$w.'" width="'.$w.'" height="'.$h.'" />';
+ print '<img src="'.$url.'&amp;w='.$w.'&amp;h='.$w.'" '.$p.'/>';
print '</a>';
}