In IPTC, extracting an item now tries to add keywords as tags.
This commit is contained in:
parent
f4ad8c3c8b
commit
82bb01ba71
|
@ -34,12 +34,12 @@ class iptc_Core {
|
||||||
$info = getJpegHeader($item->file_path());
|
$info = getJpegHeader($item->file_path());
|
||||||
if ($info !== FALSE) {
|
if ($info !== FALSE) {
|
||||||
$iptcBlock = getIptcBlock($info);
|
$iptcBlock = getIptcBlock($info);
|
||||||
if ($iptcBlock !== FALSE) {
|
if ($iptcBlock !== FALSE) {
|
||||||
$iptc = iptcparse($iptcBlock);
|
$iptc = iptcparse($iptcBlock);
|
||||||
} else {
|
} else {
|
||||||
$iptc = array();
|
$iptc = array();
|
||||||
}
|
}
|
||||||
$xmp = getXmpDom($info);
|
$xmp = getXmpDom($info);
|
||||||
|
|
||||||
foreach (self::keys() as $keyword => $iptcvar) {
|
foreach (self::keys() as $keyword => $iptcvar) {
|
||||||
$iptc_key = $iptcvar[0];
|
$iptc_key = $iptcvar[0];
|
||||||
|
@ -71,6 +71,18 @@ class iptc_Core {
|
||||||
$record->key_count = count($keys);
|
$record->key_count = count($keys);
|
||||||
$record->dirty = 0;
|
$record->dirty = 0;
|
||||||
$record->save();
|
$record->save();
|
||||||
|
if (!empty($iptc['KEYWORDS']) {
|
||||||
|
$tags = explode(';', $iptc['KEYWORDS']);
|
||||||
|
foreach ($tags as $tag) {
|
||||||
|
try {
|
||||||
|
tag::add($item, $tag);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Kohana_Log::add("error", "Error adding tag: $tag\n"
|
||||||
|
. $e->getMessage() . "\n"
|
||||||
|
. $e->getTraceAsString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function get($item) {
|
static function get($item) {
|
||||||
|
|
Reference in New Issue
Block a user