merge r6484 from trunk to branch 2.1

- revert r6473 and r6475
- moved call to event format_exif_data earlier

git-svn-id: http://piwigo.org/svn/branches/2.1@6485 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2010-06-07 19:06:20 +00:00
parent 40cab61e1f
commit 497203da33
2 changed files with 32 additions and 33 deletions

View file

@ -117,31 +117,25 @@ function get_exif_data($filename, $map)
// Read EXIF data // Read EXIF data
if ($exif = @read_exif_data($filename)) if ($exif = @read_exif_data($filename))
{ {
if ($map != null) $exif = trigger_event('format_exif_data', $exif, $filename );
{ foreach ($map as $key => $field)
foreach ($map as $key => $field) {
{ if (strpos($field, ';') === false)
if (strpos($field, ';') === false) {
{ if (isset($exif[$field]))
if (isset($exif[$field])) {
{ $result[$key] = $exif[$field];
$result[$key] = $exif[$field]; }
} }
} else
else {
{ $tokens = explode(';', $field);
$tokens = explode(';', $field); if (isset($exif[$tokens[0]][$tokens[1]]))
if (isset($exif[$tokens[0]][$tokens[1]])) {
{ $result[$key] = $exif[$tokens[0]][$tokens[1]];
$result[$key] = $exif[$tokens[0]][$tokens[1]]; }
} }
} }
}
}
else
{
$result = $exif;
}
} }
return $result; return $result;

View file

@ -29,15 +29,20 @@
include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php'); include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
if (($conf['show_exif']) and (function_exists('read_exif_data'))) if (($conf['show_exif']) and (function_exists('read_exif_data')))
{ {
$exif = get_exif_data($picture['current']['image_path'], null); $exif_mapping = array();
foreach ($conf['show_exif_fields'] as $field)
{
$exif_mapping[$field] = $field;
}
$exif = get_exif_data($picture['current']['image_path'], $exif_mapping);
if (count($exif) == 0 and $picture['current']['has_high']) if (count($exif) == 0 and $picture['current']['has_high'])
{ {
$exif = get_exif_data($picture['current']['high_url'], null); $exif = get_exif_data($picture['current']['high_url'], $exif_mapping);
} }
if (count($exif) > 0) if (count($exif) > 0)
{ {
$exif = trigger_event('format_exif_data', $exif, $picture['current'] );
$tpl_meta = array( $tpl_meta = array(
'TITLE' => 'EXIF Metadata', 'TITLE' => 'EXIF Metadata',
'lines' => array(), 'lines' => array(),
@ -60,14 +65,14 @@ if (($conf['show_exif']) and (function_exists('read_exif_data')))
else else
{ {
$tokens = explode(';', $field); $tokens = explode(';', $field);
if (isset($exif[$tokens[0]][$tokens[1]])) if (isset($exif[$field]))
{ {
$key = $tokens[1]; $key = $tokens[1];
if (isset($lang['exif_field_'.$tokens[1]])) if (isset($lang['exif_field_'.$key]))
{ {
$key = $lang['exif_field_'.$tokens[1]]; $key = $lang['exif_field_'.$key];
} }
$tpl_meta['lines'][$key] = $exif[$tokens[0]][$tokens[1]]; $tpl_meta['lines'][$key] = $exif[$field];
} }
} }
} }