Permalink
Browse files

media getting metadata fix

  • Loading branch information...
1 parent e18ba57 commit 3e98e6857f2c48127d4169d02e341d1013c00bac @akate akate committed Jun 29, 2011
Showing with 62 additions and 62 deletions.
  1. +39 −27 conf/mediameta.php
  2. +14 −21 inc/media.php
  3. +9 −14 lib/tpl/default/detail.php
View
@@ -29,51 +29,63 @@
'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')),
);
View
@@ -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>';
@@ -52,25 +52,20 @@
<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>';
}
}

0 comments on commit 3e98e68

Please sign in to comment.