aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_metadata.inc.php
diff options
context:
space:
mode:
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