mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 19:59:56 +03:00
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
This commit is contained in:
parent
13cd251e63
commit
9f037e7cea
1 changed files with 28 additions and 7 deletions
|
@ -50,15 +50,17 @@ function get_iptc_data($filename, $map)
|
||||||
$rmap = array_flip($map);
|
$rmap = array_flip($map);
|
||||||
foreach (array_keys($rmap) as $iptc_key)
|
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)
|
if ($iptc_key == '2#025')
|
||||||
while ($value[0] == chr(0))
|
|
||||||
{
|
{
|
||||||
$value = substr($value, 1);
|
$value = implode(',',
|
||||||
|
array_map('clean_iptc_value',$iptc[$iptc_key]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$value = clean_iptc_value($iptc[$iptc_key][0]);
|
||||||
}
|
}
|
||||||
// remove binary nulls
|
|
||||||
$value = str_replace(chr(0x00), ' ', $value);
|
|
||||||
|
|
||||||
foreach (array_keys($map, $iptc_key) as $pwg_key)
|
foreach (array_keys($map, $iptc_key) as $pwg_key)
|
||||||
{
|
{
|
||||||
|
@ -70,4 +72,23 @@ function get_iptc_data($filename, $map)
|
||||||
}
|
}
|
||||||
return $result;
|
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;
|
||||||
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue