Hi,
to get IPTC data from images i added following code in mymodule.
I also convert the Strings from IPTC to utf8 because some German
specialchars wont import to the database.

function mymodule_metadata_info() {
  foreach (_file_image_iptc() as $name => $data) {
    $info[$data['rdf']] = array('name' => t($data['name']));
    if (isset($data['theme']))
      $info[$data['rdf']]['theme'] = $data['theme'];
  }
  return $info;
}

function mymodule_metadata_parse($filename, $mimetype){
	if (!array_key_exists($mimetype, file_image_mime_types()))
        return NULL;
	
	$size = getimagesize($filename, $info);
	$iptc = _file_image_iptc();
	if (isset($info["APP13"])) {
		$iptc_info = iptcparse($info["APP13"]);
		$rdf_iptc = array();
		foreach ($iptc as $name => $data) {
	     	$rdf_iptc[$data['rdf']] = array_map('utf8_encode', $iptc_info[key($data['iptc'])]);
        } 
	    return $rdf_iptc;
	}else{
		return NULL;
	}
}

function _file_image_iptc() {
	return array(
		 'author' => array('name' => 'Author', 'iptc' => array('2#080' => NULL),'rdf' => 'iptc:author', 'type' => '', 'default' => 0),
	     'author_titel' => array('name' => 'Author Titel', 'iptc' => array('2#085' => NULL),'rdf' => 'iptc:author_titel', 'type' => '', 'default' => 0),
		 'categories' => array('name' => 'Categories', 'iptc' => array('2#020' => NULL),'rdf' => 'iptc:categories', 'type' => '', 'default' => 0),
		 'feeds' => array('name' => 'Feeds', 'iptc' => array('2#025' => NULL),'rdf' => 'iptc:feeds', 'type' => '', 'default' => 0),
		 'copyright' => array('name' => 'Copyright', 'iptc' => array('2#116' => NULL),'rdf' => 'iptc:copyright', 'type' => '', 'default' => 0),
		 'description' => array('name' => 'Description', 'iptc' => array('2#120' => NULL),'rdf' => 'iptc:description', 'type' => '', 'default' => 0),
		 'author_description' => array('name' => 'Author Description', 'iptc' => array('2#122' => NULL),'rdf' => 'iptc:author_description', 'type' => '', 'default' => 0),
		 'source_titel' => array('name' => 'Source Titel', 'iptc' => array('2#105' => NULL),'rdf' => 'iptc:source_titel', 'type' => '', 'default' => 0),
		 'source_assignment' => array('name' => 'Source Assignment', 'iptc' => array('2#040' => NULL),'rdf' => 'iptc:source_assignment', 'type' => '', 'default' => 0),
		 'source_assistant' => array('name' => 'Source Assistant', 'iptc' => array('2#110' => NULL),'rdf' => 'iptc:source_assistant', 'type' => '', 'default' => 0),
		 'source_repository' => array('name' => 'Source Repository', 'iptc' => array('2#115' => NULL),'rdf' => 'iptc:source_repository', 'type' => '', 'default' => 0),
		 'source_city' => array('name' => 'Source City', 'iptc' => array('2#090' => NULL),'rdf' => 'iptc:source_city', 'type' => '', 'default' => 0),
		 'source_state' => array('name' => 'Source State', 'iptc' => array('2#095' => NULL),'rdf' => 'iptc:source_state', 'type' => '', 'default' => 0),
		 'source_country' => array('name' => 'Source Country', 'iptc' => array('2#095' => NULL),'rdf' => 'iptc:source_country', 'type' => '', 'default' => 0),	    
	);
}

this is just a quick and dirty solution which works fine for me.
it would be nice to implement IPTC feature in the fileframework too.

CommentFileSizeAuthor
#1 iptc_parse-1006150-1.patch11.06 KBelaman

Comments

elaman’s picture

Status: Needs work » Needs review
StatusFileSize
new11.06 KB

Here is the patch, which adds this functionality to FF.

johanneshahn’s picture

Status: Needs review » Closed (fixed)

patch applied

avpaderno’s picture

Issue tags: -images, -iptc, -fileframework