merge r6473 from trunk to branch 2.1

- quick fix (maybe not the cleanest) of regression 2.0 -> 2.1 when displaying metadata on picture page (event called with different input)

git-svn-id: http://piwigo.org/svn/branches/2.1@6474 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2010-06-06 10:14:26 +00:00
parent e49ff390d3
commit 4664661c50
2 changed files with 27 additions and 27 deletions

View file

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

View file

@ -29,18 +29,11 @@
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_mapping = array(); $exif = get_exif_data($picture['current']['image_path'], null);
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'], $exif_mapping); $exif = get_exif_data($picture['current']['high_url'], null);
} }
if (count($exif) > 0) if (count($exif) > 0)
{ {
$exif = trigger_event('format_exif_data', $exif, $picture['current'] ); $exif = trigger_event('format_exif_data', $exif, $picture['current'] );