aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_metadata.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2004-11-20 18:07:51 +0000
committerplegall <plg@piwigo.org>2004-11-20 18:07:51 +0000
commit9f037e7cea37aafd562fa494afd9a289c60a5855 (patch)
tree6c6812d426d0e8d6992caff2896147d4c7400242 /include/functions_metadata.inc.php
parent13cd251e63232e88069759e8396b0c35b991088b (diff)
takes not only the first keyword in IPTC field 2#025
git-svn-id: http://piwigo.org/svn/trunk@611 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_metadata.inc.php35
1 files changed, 28 insertions, 7 deletions
diff --git a/include/functions_metadata.inc.php b/include/functions_metadata.inc.php
index aed7d1ff2..930c90979 100644
--- a/include/functions_metadata.inc.php
+++ b/include/functions_metadata.inc.php
@@ -50,16 +50,18 @@ function get_iptc_data($filename, $map)
$rmap = array_flip($map);
foreach (array_keys($rmap) as $iptc_key)
{
- if (isset($iptc[$iptc_key][0]) and $value = $iptc[$iptc_key][0])
+ if (isset($iptc[$iptc_key][0]))
{
- // strip leading zeros (weird Kodak Scanner software)
- while ($value[0] == chr(0))
+ if ($iptc_key == '2#025')
{
- $value = substr($value, 1);
+ $value = implode(',',
+ array_map('clean_iptc_value',$iptc[$iptc_key]));
}
- // remove binary nulls
- $value = str_replace(chr(0x00), ' ', $value);
-
+ else
+ {
+ $value = clean_iptc_value($iptc[$iptc_key][0]);
+ }
+
foreach (array_keys($map, $iptc_key) as $pwg_key)
{
$result[$pwg_key] = $value;
@@ -70,4 +72,23 @@ function get_iptc_data($filename, $map)
}
return $result;
}
+
+/**
+ * return a cleaned IPTC value
+ *
+ * @param string value
+ * @return string
+ */
+function clean_iptc_value($value)
+{
+ // strip leading zeros (weird Kodak Scanner software)
+ while ($value[0] == chr(0))
+ {
+ $value = substr($value, 1);
+ }
+ // remove binary nulls
+ $value = str_replace(chr(0x00), ' ', $value);
+
+ return $value;
+}
?> \ No newline at end of file