Index: exif.class.php
===================================================================
RCS file: /cvs/drupal/contributions/modules/exif/Attic/exif.class.php,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 exif.class.php
--- exif.class.php	5 Feb 2009 20:11:53 -0000	1.1.2.2
+++ exif.class.php	19 Jun 2009 10:08:53 -0000
@@ -35,7 +35,7 @@
 	 * @return array a list of exif tags to read for this image
 	 */
 	public function getExifFields($arCckFields=array()){
-		$arSections = array('exif','file','computed','ifd0','gps','winxp');
+		$arSections = array('exif','file','computed','ifd0','gps','winxp','iptc');
 		$arExif = array();
 		
 		foreach ($arCckFields as $field){
@@ -67,7 +67,94 @@
 		}
 		$info = array();
 		foreach ($arTagNames as $tagName) {
-			$info[$tagName['tag']] = $arSmallExif[$tagName['tag']];
+			if ($tagName['section'] != 'iptc') {
+				$info[$tagName['tag']] = $arSmallExif[$tagName['tag']];
+			}
+		}
+		return $info;
+	}
+
+
+	public function readIPTCTags($file,$arTagNames=array()) {
+		$humanReadableKey = array(
+		"2#202" => "object_data_preview_data",
+		"2#201" => "object_data_preview_file_format_version",
+		"2#200" => "object_data_preview_file_format",
+		"2#154" => "audio_outcue",
+		"2#153" => "audio_duration",
+		"2#152" => "audio_sampling_resolution",
+		"2#151" => "audio_sampling_rate",
+		"2#150" => "audio_type",
+		"2#135" => "language_identifier",
+		"2#131" => "image_orientation",
+		"2#130" => "image_type",
+		"2#125" => "rasterized_caption",		
+		"2#122" => "writer",
+		"2#120" => "caption",
+		"2#118" => "contact",
+		"2#116" => "copyright_notice",
+		"2#115" => "source",
+		"2#110" => "credit",
+		"2#105" => "headline",
+		"2#103" => "original_transmission_reference",
+		"2#101" => "country_name",
+		"2#100" => "country_code",
+		"2#095" => "state",
+		"2#092" => "sublocation",
+		"2#090" => "city",
+		"2#085" => "by_line_title",
+		"2#080" => "by_line",
+		"2#075" => "object_cycle",
+		"2#070" => "program_version",
+		"2#065" => "originating_program",
+		"2#063" => "digital_creation_time",
+		"2#062" => "digital_creation_date",		
+		"2#060" => "creation_time",
+		"2#055" => "creation_date",
+		"2#050" => "reference_number",
+		"2#047" => "reference_date",
+		"2#045" => "reference_service",
+		"2#042" => "action_advised",
+		"2#040" => "special_instruction",
+		"2#038" => "expiration_time",
+		"2#037" => "expiration_date",
+		"2#035" => "release_time",
+		"2#030" => "release_date",
+		"2#027" => "content_location_name",
+		"2#026" => "content_location_code",
+		"2#025" => "keywords",
+		"2#022" => "fixture_identifier",
+		"2#020" => "supplemental_category",	
+		"2#015" => "category",
+		"2#010" => "subject_reference",	
+		"2#010" => "urgency",
+		"2#008" => "editorial_update",
+		"2#007" => "edit_status",
+		"2#005" => "object_name",
+		"2#004" => "object_attribute_reference",
+		"2#003" => "object_type_reference",
+		"2#000" => "record_version"
+		);
+		$size = GetImageSize ($file, $infoImage);
+		$iptc = iptcparse($infoImage["APP13"]);
+		$arSmallIPTC = array();
+		foreach($iptc as $key => $value)
+		{
+			$resultTag = "";
+			foreach($value as $innerkey => $innervalue)
+			{				
+				if( ($innerkey+1) != count($value) )
+					$resultTag.=$innervalue.", ";
+				else
+					$resultTag.=$innervalue;				
+			}		
+			$arSmallIPTC[strtolower($humanReadableKey[$key])] = $resultTag;
+		}
+		$info = array();
+		foreach ($arTagNames as $tagName) {
+			if ($tagName['section'] == "iptc") {
+				$info[$tagName['tag']] = $arSmallIPTC[$tagName['tag']];
+			}
 		}
 		return $info;
 	}
Index: exif.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/exif/exif.module,v
retrieving revision 1.9.2.6
diff -u -r1.9.2.6 exif.module
--- exif.module	13 Apr 2009 11:57:49 -0000	1.9.2.6
+++ exif.module	19 Jun 2009 10:08:53 -0000
@@ -90,14 +90,16 @@
 				$fid = db_result(db_query("SELECT fid FROM {files} WHERE filepath = '%s'", $image_path));
 				$file = file_create_path($image_path);
 
-				$data = $exif->readExifTags($file,$ar_exif_fields);
-				
+				$data1 = $exif->readExifTags($file,$ar_exif_fields);
+				$data2 = $exif->readIPTCTags($file,$ar_exif_fields);
+				$data = array_merge($data1,$data2);
+
 				// prepare data to be stored in CCK
 				$i = 0;
 				foreach ($data as $key => $value) {
 					$field_name = 'field_' . $ar_exif_fields[$i]['section'] . '_' . $key;
 					$tmp = $node->$field_name;
-					
+
 					$date_array = array('datetimeoriginal','datetime','datetimedigitized');
 					//incase we get a datefield, we need to reformat it to the ISO 8601 standard:
 					//which will look something like 2004-02-12T15:19:21
@@ -175,17 +177,98 @@
 	$ar_exif = read_exif_data($filepath,0,true);
 
 	$out = '';
-	$rows = array();
+	$rows1 = array();
 	$help = t('This would be the keyword for your CCK field.');
 	foreach ($ar_exif as $key => $value){
 		if(is_array($value)){
-			$rows[] = array('data'=>array($key,$help),'class'=>'tag_type');
+			$rows1[] = array('data'=>array($key,$help),'class'=>'tag_type');
 			foreach($value as $key2 => $value2){
-				$rows[] = array('data'=>array($key2,check_plain(utf8_encode($value2))));
+				$rows1[] = array('data'=>array($key2,check_plain(utf8_encode($value2))));
 			}
 		}
 
 	}
+		$humanReadableKey = array(
+		"2#202" => "object_data_preview_data",
+		"2#201" => "object_data_preview_file_format_version",
+		"2#200" => "object_data_preview_file_format",
+		"2#154" => "audio_outcue",
+		"2#153" => "audio_duration",
+		"2#152" => "audio_sampling_resolution",
+		"2#151" => "audio_sampling_rate",
+		"2#150" => "audio_type",
+		"2#135" => "language_identifier",
+		"2#131" => "image_orientation",
+		"2#130" => "image_type",
+		"2#125" => "rasterized_caption",		
+		"2#122" => "writer",
+		"2#120" => "caption",
+		"2#118" => "contact",
+		"2#116" => "copyright_notice",
+		"2#115" => "source",
+		"2#110" => "credit",
+		"2#105" => "headline",
+		"2#103" => "original_transmission_reference",
+		"2#101" => "country_name",
+		"2#100" => "country_code",
+		"2#095" => "state",
+		"2#092" => "sublocation",
+		"2#090" => "city",
+		"2#085" => "by_line_title",
+		"2#080" => "by_line",
+		"2#075" => "object_cycle",
+		"2#070" => "program_version",
+		"2#065" => "originating_program",
+		"2#063" => "digital_creation_time",
+		"2#062" => "digital_creation_date",		
+		"2#060" => "creation_time",
+		"2#055" => "creation_date",
+		"2#050" => "reference_number",
+		"2#047" => "reference_date",
+		"2#045" => "reference_service",
+		"2#042" => "action_advised",
+		"2#040" => "special_instruction",
+		"2#038" => "expiration_time",
+		"2#037" => "expiration_date",
+		"2#035" => "release_time",
+		"2#030" => "release_date",
+		"2#027" => "content_location_name",
+		"2#026" => "content_location_code",
+		"2#025" => "keywords",
+		"2#022" => "fixture_identifier",
+		"2#020" => "supplemental_category",	
+		"2#015" => "category",
+		"2#010" => "subject_reference",	
+		"2#010" => "urgency",
+		"2#008" => "editorial_update",
+		"2#007" => "edit_status",
+		"2#005" => "object_name",
+		"2#004" => "object_attribute_reference",
+		"2#003" => "object_type_reference",
+		"2#000" => "record_version"
+		);
+	$size = GetImageSize ($filepath, $infoImage);
+	$iptc = iptcparse($infoImage["APP13"]);
+	$rows2 = array();
+	$help = t('This would be the keyword for your CCK field.');
+	if(is_array($iptc)){
+		$rows2[] = array('data'=>array('IPTC',$help),'class'=>'tag_type');
+		foreach($iptc as $key => $value)
+		{
+			$resultTag = "";
+			foreach($value as $innerkey => $innervalue)
+			{
+				if( ($innerkey+1) != count($value) )
+				$resultTag.=$innervalue.", ";
+				else
+				$resultTag.=$innervalue;
+			}
+			$rows2[] = array('data'=>array($humanReadableKey[$key],check_plain(utf8_encode($resultTag))));
+		}
+	}
+
+
+	$rows = array_merge($rows1,$rows2);
 	$header = array(t('Key'),t('Value'));
 	$out .= theme('table',$header,$rows);
 	return $out;

