Merge pull request #124 from chalbertgit/master
Incorporated tag module's add keyword into iptc::extract
This commit is contained in:
commit
dc37f4be48
@ -34,12 +34,12 @@ class iptc_Core {
|
||||
$info = getJpegHeader($item->file_path());
|
||||
if ($info !== FALSE) {
|
||||
$iptcBlock = getIptcBlock($info);
|
||||
if ($iptcBlock !== FALSE) {
|
||||
$iptc = iptcparse($iptcBlock);
|
||||
} else {
|
||||
if ($iptcBlock !== FALSE) {
|
||||
$iptc = iptcparse($iptcBlock);
|
||||
} else {
|
||||
$iptc = array();
|
||||
}
|
||||
$xmp = getXmpDom($info);
|
||||
$xmp = getXmpDom($info);
|
||||
|
||||
foreach (self::keys() as $keyword => $iptcvar) {
|
||||
$iptc_key = $iptcvar[0];
|
||||
@ -71,6 +71,18 @@ class iptc_Core {
|
||||
$record->key_count = count($keys);
|
||||
$record->dirty = 0;
|
||||
$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) {
|
||||
|
Reference in New Issue
Block a user