Browse Source

Added a method to display exif metadata from the EXIF datstream of an object.

pull/105/head
mroy 14 years ago
parent
commit
0944517607
  1. 41
      plugins/Exiftool.inc

41
plugins/Exiftool.inc

@ -8,7 +8,15 @@
*/
class Exiftool {
function Exiftool() {
private $pid = NULL;
private $item = NULL;
function __construct($pid) {
//drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$this->pid = $pid;
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$this->item = new Fedora_Item($this->pid);
}
function extractMetadata($parameterArray, $dsid, $file, $file_ext) {
@ -21,4 +29,35 @@ class Exiftool {
$_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix;
return TRUE;
}
function displayMetadata() {
$output='';
$exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('EXIF'));
$description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#','Description');
if ($description->length > 0) {
$description=$description->item(0);
$output .= '<div class="fedora_technical_metadata"><ul>';
for ($i=0;$i<$description->childNodes->length;$i++){
$name=$description->childNodes->item($i)->nodeName;
$value=$description->childNodes->item($i)->nodeValue;
if ($name != '#text' && !preg_match('/^System\:.*$/',$name) && trim($value) != '') {
list($type,$name) = preg_split('/\:/',$name);
$name = trim(preg_replace('/(?<!^)([A-Z][a-z]|(?<=[a-z])[A-Z])/'," $1", $name));
$output .= '<li><b>'.$name. '</b>: '. $value .' </li>';
}
}
$output.='</ul></div>';
$fieldset = array(
'#title' => t("!text", array('!text' => 'Technical Metadata')),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#value' => $output
);
$output = theme('fieldset', $fieldset);
}
return $output;
}
}

Loading…
Cancel
Save