aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2010-06-07 19:05:04 +0000
committerrvelices <rv-github@modusoptimus.com>2010-06-07 19:05:04 +0000
commit249094fee910432ec41a6573638282cf167a2c85 (patch)
tree037c5c8ad76cbaada1dce54c6a078be1f91c6a2b
parent6fbfd767b9147a60b26614f6b2e12b6f4648a903 (diff)
- revert r6473 and r6475
- moved call to event format_exif_data earlier git-svn-id: http://piwigo.org/svn/trunk@6484 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/functions_metadata.inc.php44
-rw-r--r--include/picture_metadata.inc.php21
2 files changed, 32 insertions, 33 deletions
diff --git a/include/functions_metadata.inc.php b/include/functions_metadata.inc.php
index 2b298606f..95ed2befc 100644
--- a/include/functions_metadata.inc.php
+++ b/include/functions_metadata.inc.php
@@ -117,31 +117,25 @@ function get_exif_data($filename, $map)
// Read EXIF data
if ($exif = @read_exif_data($filename))
{
- if ($map != null)
- {
- foreach ($map as $key => $field)
- {
- if (strpos($field, ';') === false)
- {
- if (isset($exif[$field]))
- {
- $result[$key] = $exif[$field];
- }
- }
- else
- {
- $tokens = explode(';', $field);
- if (isset($exif[$tokens[0]][$tokens[1]]))
- {
- $result[$key] = $exif[$tokens[0]][$tokens[1]];
- }
- }
- }
- }
- else
- {
- $result = $exif;
- }
+ $exif = trigger_event('format_exif_data', $exif, $filename );
+ foreach ($map as $key => $field)
+ {
+ if (strpos($field, ';') === false)
+ {
+ if (isset($exif[$field]))
+ {
+ $result[$key] = $exif[$field];
+ }
+ }
+ else
+ {
+ $tokens = explode(';', $field);
+ if (isset($exif[$tokens[0]][$tokens[1]]))
+ {
+ $result[$key] = $exif[$tokens[0]][$tokens[1]];
+ }
+ }
+ }
}
return $result;
diff --git a/include/picture_metadata.inc.php b/include/picture_metadata.inc.php
index 9c5a4a980..b87ae0700 100644
--- a/include/picture_metadata.inc.php
+++ b/include/picture_metadata.inc.php
@@ -29,15 +29,20 @@
include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
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'])
{
- $exif = get_exif_data($picture['current']['high_url'], null);
+ $exif = get_exif_data($picture['current']['high_url'], $exif_mapping);
}
+
if (count($exif) > 0)
{
- $exif = trigger_event('format_exif_data', $exif, $picture['current'] );
-
$tpl_meta = array(
'TITLE' => 'EXIF Metadata',
'lines' => array(),
@@ -60,14 +65,14 @@ if (($conf['show_exif']) and (function_exists('read_exif_data')))
else
{
$tokens = explode(';', $field);
- if (isset($exif[$tokens[0]][$tokens[1]]))
+ if (isset($exif[$field]))
{
$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];
}
}
}