Fixes for the initial commit which turned out to have been the wrong file (oops)
Support for the Debian Stable version of exiv2, 0.16.
This commit is contained in:
parent
9165ff3594
commit
3567291609
@ -33,8 +33,25 @@ class author_Core {
|
|||||||
$user_name = $owner->full_name;
|
$user_name = $owner->full_name;
|
||||||
|
|
||||||
$exiv = module::get_var('author', 'exiv_path');
|
$exiv = module::get_var('author', 'exiv_path');
|
||||||
|
$version = module::get_var('author', 'exiv_version');
|
||||||
|
|
||||||
|
/*
|
||||||
|
Debian stable ships with exiv2 0.16 at the time of writing. You get
|
||||||
|
roughly the same output out of the utility as with 0.20, but you have
|
||||||
|
to invoke it several times.
|
||||||
|
|
||||||
|
The real threshhold for this might be somewhere between 0.16 and 0.20,
|
||||||
|
but the 0.16 way of doing things is forward compatible.
|
||||||
|
*/
|
||||||
$exivData = array();
|
$exivData = array();
|
||||||
|
if ($version < 0.20) {
|
||||||
|
exec("$exiv -p x " . escapeshellarg($item->file_path()), $exivData);
|
||||||
|
exec("$exiv -p i " . escapeshellarg($item->file_path()), $exivData);
|
||||||
|
exec("$exiv -p t " . escapeshellarg($item->file_path()), $exivData);
|
||||||
|
} else {
|
||||||
exec("$exiv -p a " . escapeshellarg($item->file_path()), $exivData);
|
exec("$exiv -p a " . escapeshellarg($item->file_path()), $exivData);
|
||||||
|
}
|
||||||
|
|
||||||
$has = array();
|
$has = array();
|
||||||
$mod = array();
|
$mod = array();
|
||||||
foreach ($exivData as $line)
|
foreach ($exivData as $line)
|
||||||
@ -55,19 +72,25 @@ class author_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!array_key_exists('Exif.Image.Artist', $has)) { $mod['Exif.Image.Artist'] = $byline; }
|
if (!array_key_exists('Exif.Image.Artist', $has)) { $mod['Exif.Image.Artist'] = $byline; }
|
||||||
if (!array_key_exists('Xmp.dc.creator', $has)) { $mod['Xmp.dc.creator'] = $byline; }
|
|
||||||
if (!array_key_exists('Iptc.Application2.Byline', $has)) { $mod['Iptc.Application2.Byline'] = $byline; }
|
if (!array_key_exists('Iptc.Application2.Byline', $has)) { $mod['Iptc.Application2.Byline'] = $byline; }
|
||||||
|
|
||||||
# Apply our own image terms URL.
|
/* Apply the credit block */
|
||||||
$terms = module::get_var("author", "usage_terms")
|
$credit = module::get_var("author", "credit");
|
||||||
|
if ($credit != '') {
|
||||||
|
$mod['Iptc.Application2.Credit'] = $credit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Older versions doesn't support XMP writing.
|
||||||
|
*/
|
||||||
|
if ($version >= 0.20) {
|
||||||
|
if (!array_key_exists('Xmp.dc.creator', $has)) { $mod['Xmp.dc.creator'] = $byline; }
|
||||||
|
|
||||||
|
/* Apply our own image terms URL */
|
||||||
|
$terms = module::get_var("author", "usage_terms");
|
||||||
if ($terms != '') {
|
if ($terms != '') {
|
||||||
$mod['Xmp.xmpRights.UsageTerms'] = 'http://wiki.sverok.se/wiki/Bildbank-Bilder';
|
$mod['Xmp.xmpRights.UsageTerms'] = 'http://wiki.sverok.se/wiki/Bildbank-Bilder';
|
||||||
}
|
}
|
||||||
|
|
||||||
# ..and credit.
|
|
||||||
$credit = module::get_var("author", "credit")
|
|
||||||
if ($credit != '') {
|
|
||||||
$mod['Iptc.Application2.Credit'] = $credit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$line = $exiv . ' ';
|
$line = $exiv . ' ';
|
||||||
|
@ -48,6 +48,10 @@ class author_installer {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
module::set_var("author", "exiv_path", $exiv);
|
module::set_var("author", "exiv_path", $exiv);
|
||||||
|
$out = array();
|
||||||
|
exec("$exiv -V", $out);
|
||||||
|
$parts = split(' ', $out[0]);
|
||||||
|
module::set_var("author", "exiv_version", $parts[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name = "Author"
|
name = "Author"
|
||||||
description = "Allows for the display and modification of the Author/Photographer/Byline data in photos."
|
description = "Allows for the display and modification of the Author/Photographer/Byline data in photos."
|
||||||
version = 1
|
version = 2
|
||||||
|
Reference in New Issue
Block a user