--- exif.module	2010-07-23 18:47:46.000000000 +0100
+++ exifKW.module	2010-07-29 17:33:22.000000000 +0100
@@ -108,11 +108,19 @@ function exif_nodeapi(&$node, $op, $teas
           case 'ifd0_datetime':
             $first_delta = _exif_date_handler($field, $exif_value);
             break;
+          case 'iptc_keywords':
+            $first_delta = _exif_keyword_handler($field, $exif_value);
+            break;
           default:
-            $first_delta = array('value' => $data[$exif_name]);
+            $first_delta = array('value' => $exif_value);
             break;
         }
-        $node->{$field_name}[0] = $first_delta;
+        
+        if ($exif_name == 'iptc_keywords' && $field['type'] == 'content_taxonomy') {
+          $node->{$field_name} = $first_delta;
+        } else {
+          $node->{$field_name}[0] = $first_delta;
+        }
       }
       break;
   }
@@ -191,6 +199,42 @@ function _exif_date_handler($field, $exi
 }
 
 /**
+ * Helper function to handle keywords if the corresponding field is defined by content_taxonomy.
+ *
+ * @param array $field
+ *   The field definition for the taxonomy keyword field
+ * @param string $exif_date
+ *   The compound keyword string extracted from the IPTC header.
+ * @return array
+ *   The field value array for delta = 0
+ */
+function _exif_keyword_handler($field, $exif_value) {
+  if ($field['type'] != 'content_taxonomy') {
+    return array('value' => $exif_value);
+  }
+  
+  switch ($field['widget']['type']) {
+    case 'content_taxonomy_autocomplete':
+      // Process the values in exactly the same way as content_taxonomy_autocomplete does when validating the node form.
+      $extracted_ids = content_taxonomy_autocomplete_tags_get_tids($exif_value, $field['vid'], content_taxonomy_field_get_parent($field), $field['widget']['extra_parent']);
+      
+      if ((!$field['multiple'] && count(content_taxonomy_autocomplete_split_tags($value, $field['vid'])) > 1)
+        || ($field['multiple'] >= 2 && count(content_taxonomy_autocomplete_split_tags($value, $field['vid'])) > $field['multiple'])
+        || ($field['widget']['new_terms'] == 'deny' && is_array($extracted_ids['non_existing_terms']))) {
+        return array();
+      }
+      
+      // This is just a dummy variable to make things work.
+      $element = array('#columns' =>  array('value'));
+      return content_taxonomy_autocomplete_form2data($extracted_ids, $field, $element);
+      break;
+    default:
+      return array('value' => $exif_value);
+      break;
+  }
+}
+
+/**
  * Let's check if this node type contains an image field.
  *
  * @param $fields fields from this content type
@@ -344,4 +388,4 @@ function fast_gallery_token_values($type
     //dsm($tokens);
     return $tokens;
   }
-}
\ No newline at end of file
+}
