From 9ab9ba075113d51d97d24755b8c0eb61639c4bd4 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 14 Dec 2010 17:46:30 -0600 Subject: [PATCH] Added some checks to the displayMetadata method so that it does not cause errors if the exif datastream is empty or missing. --- plugins/Exiftool.inc | 53 +++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/plugins/Exiftool.inc b/plugins/Exiftool.inc index d4feac7a..ec6d7ad0 100644 --- a/plugins/Exiftool.inc +++ b/plugins/Exiftool.inc @@ -32,32 +32,35 @@ class Exiftool { function displayMetadata() { $output=''; - $exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('EXIF')); - if ($exifDom != NULL) { - $description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#','Description'); - if ($description->length > 0) { - $description=$description->item(0); - $output .= '
'; + $exif = $this->item->get_datastream_dissemination('EXIF'); + if (trim($exif) != '') { + $exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('EXIF')); + if ($exifDom != NULL) { + $description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#','Description'); + if ($description->length > 0) { + $description=$description->item(0); + $output .= '
'; - $fieldset = array( - '#title' => t("!text", array('!text' => 'Technical Metadata')), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#value' => $output - ); - $output = theme('fieldset', $fieldset); - } - } + $fieldset = array( + '#title' => t("!text", array('!text' => 'Technical Metadata')), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#value' => $output + ); + $output = theme('fieldset', $fieldset); + } + } + } return $output; }