diff options
-rw-r--r-- | conf/mediameta.php | 66 | ||||
-rw-r--r-- | inc/media.php | 35 | ||||
-rw-r--r-- | lib/tpl/default/detail.php | 23 |
3 files changed, 62 insertions, 62 deletions
diff --git a/conf/mediameta.php b/conf/mediameta.php index 8ad148aec..0428a4b88 100644 --- a/conf/mediameta.php +++ b/conf/mediameta.php @@ -29,51 +29,63 @@ $fields = array( 'img_title', 'text'), - 20 => array('Iptc.Caption', + 20 => array('', + 'img_date', + 'date', + array('Date.EarliestTime')), + + 30 => array('', + 'img_fname', + 'text', + array('File.Name')), + + 40 => array('Iptc.Caption', 'img_caption', 'textarea', array('Exif.UserComment', 'Exif.TIFFImageDescription', 'Exif.TIFFUserComment')), - 30 => array('Iptc.Byline', + 50 => array('Iptc.Byline', 'img_artist', 'text', array('Exif.TIFFArtist', 'Exif.Artist', 'Iptc.Credit')), - 40 => array('Iptc.CopyrightNotice', + 60 => array('Iptc.CopyrightNotice', 'img_copyr', 'text', array('Exif.TIFFCopyright', 'Exif.Copyright')), - 50 => array('Iptc.Keywords', - 'img_keywords', + 70 => array('', + 'img_format', 'text', - array('Exif.Category')), -); + array('File.Format')), + 80 => array('', + 'img_fsize', + 'text', + array('File.NiceSize')), -/** - * This configures which meta data will be shown in details view - * of the media manager. Each field of the array is an array with the - * following contents: - * fieldname - Where data will be saved (EXIF or IPTC fields) - * label - key to lookup in the $lang var, if not found printed as is - * fieldtype - 'text' or 'date' - */ -$tags = array( - array('simple.title','img_title','text'), - array('Date.EarliestTime','img_date','date'), - array('File.Name','img_fname','text'), - array(array('Iptc.Byline','Exif.TIFFArtist','Exif.Artist','Iptc.Credit'),'img_artist','text'), - array(array('Iptc.CopyrightNotice','Exif.TIFFCopyright','Exif.Copyright'),'img_copyr','text'), - array('File.Format','img_format','text'), - array('File.NiceSize','img_fsize','text'), - array('File.Width','img_width','text'), - array('File.Height','img_height','text'), - array('Simple.Camera','img_camera','text'), - array(array('IPTC.Keywords','IPTC.Category','xmp.dc:subject'),'img_keywords','text') + 90 => array('', + 'img_width', + 'text', + array('File.Width')), + + 100 => array('', + 'img_height', + 'text', + array('File.Height')), + + 110 => array('', + 'img_camera', + 'text', + array('Simple.Camera')), + + 120 => array('Iptc.Keywords', + 'img_keywords', + 'text', + array('Exif.Category')), ); diff --git a/inc/media.php b/inc/media.php index b2d608860..d90a13c81 100644 --- a/inc/media.php +++ b/inc/media.php @@ -99,14 +99,9 @@ function media_metaform($id,$auth,$fullscreen = false){ // load the field descriptions static $fields = null; if(is_null($fields)){ - - foreach (array('default','local') as $config_group) { - if (empty($config_cascade['mediameta'][$config_group])) continue; - foreach ($config_cascade['mediameta'][$config_group] as $config_file) { - if(@file_exists($config_file)){ - include($config_file); - } - } + $config_files = getConfigFiles('mediameta'); + foreach ($config_files as $config_file) { + if(@file_exists($config_file)) include($config_file); } } @@ -123,6 +118,7 @@ function media_metaform($id,$auth,$fullscreen = false){ formSecurityToken(); foreach($fields as $key => $field){ // get current value + if (empty($field[0])) continue; $tags = array($field[0]); if(is_array($field[3])) $tags = array_merge($tags,$field[3]); $value = tpl_img_getTag($tags,'',$src); @@ -837,29 +833,26 @@ function media_details($image, $auth, $rev=false) { } // load the field descriptions - static $tags = null; - if(is_null($tags)){ - foreach (array('default','local') as $config_group) { - if (empty($config_cascade['mediameta'][$config_group])) continue; - foreach ($config_cascade['mediameta'][$config_group] as $config_file) { - if(@file_exists($config_file)){ - include($config_file); - } - } + static $fields = null; + if(is_null($fields)){ + $config_files = getConfigFiles('mediameta'); + foreach ($config_files as $config_file) { + if(@file_exists($config_file)) include($config_file); } } $src = mediaFN($image, $rev); $meta = new JpegMeta($src); echo '<dl class="img_tags">'; - foreach($tags as $key => $tag){ - $t = $tag[0]; - if (!is_array($t)) $t = array($tag[0]); + foreach($fields as $key => $tag){ + $t = array(); + if (!empty($tag[0])) $t = array($tag[0]); + if(is_array($tag[3])) $t = array_merge($t,$tag[3]); $value = media_getTag($t, $meta, '-'); $value = cleanText($value); echo '<dt>'.$lang[$tag[1]].':</dt><dd>'; - if ($tag[2] == 'text') echo hsc($value); if ($tag[2] == 'date') echo dformat($value); + else echo hsc($value); echo '</dd>'; } echo '</dl>'; diff --git a/lib/tpl/default/detail.php b/lib/tpl/default/detail.php index f61ede043..f7bb37a25 100644 --- a/lib/tpl/default/detail.php +++ b/lib/tpl/default/detail.php @@ -52,25 +52,20 @@ if (!defined('DOKU_INC')) die(); <dl class="img_tags"> <?php - static $tags = null; - if(is_null($tags)){ - foreach (array('default','local') as $config_group) { - if (empty($config_cascade['mediameta'][$config_group])) continue; - foreach ($config_cascade['mediameta'][$config_group] as $config_file) { - if(@file_exists($config_file)){ - include($config_file); - } - } - } + $config_files = getConfigFiles('mediameta'); + foreach ($config_files as $config_file) { + if(@file_exists($config_file)) include($config_file); } - foreach($tags as $key => $tag){ - $t = $tag[0]; - if (!is_array($t)) $t = array($tag[0]); + + foreach($fields as $key => $tag){ + $t = array(); + if (!empty($tag[0])) $t = array($tag[0]); + if(is_array($tag[3])) $t = array_merge($t,$tag[3]); $value = tpl_img_getTag($t); if ($value) { echo '<dt>'.$lang[$tag[1]].':</dt><dd>'; - if ($tag[2] == 'text') echo hsc($value); if ($tag[2] == 'date') echo dformat($value); + else echo hsc($value); echo '</dd>'; } } |