aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exif.class.php47
1 files changed, 35 insertions, 12 deletions
diff --git a/exif.class.php b/exif.class.php
index 34da3cd..62f01c5 100644
--- a/exif.class.php
+++ b/exif.class.php
@@ -137,17 +137,20 @@ Class Exif {
$xmp = $this->openXMP($file);
$info = array();
- // Iterate over XMP fields defined by CCK.
- foreach ($arTagNames as $tagName) {
- if ($tagName['section'] == "xmp") {
- // Get XMP field.
- $config = $map[$tagName['tag']];
- $field = $this->readXMPItem($xmp, $config);
- $info[$tagName['section'] .'_'. $tagName['tag']] = $field;
+ if ($xmp != FALSE) {
+ // Iterate over XMP fields defined by CCK.
+ foreach ($arTagNames as $tagName) {
+ if ($tagName['section'] == "xmp") {
+ // Get XMP field.
+ $config = $map[$tagName['tag']];
+ $field = $this->readXMPItem($xmp, $config);
+ $info[$tagName['section'] .'_'. $tagName['tag']] = $field;
+ }
}
+
+ $this->closeXMP($xmp);
}
- $this->closeXMP($xmp);
return $info;
}
@@ -161,15 +164,20 @@ Class Exif {
* Array with XMP file and metadata.
*/
function openXMP($file) {
- // Setup
+ // Setup.
$xmpfiles = new SXMPFiles();
$xmpmeta = new SXMPMeta();
- // Open
+ // Open.
$xmpfiles->OpenFile($file);
- $xmpfiles->GetXMP($xmpmeta);
- return array('files' => $xmpfiles, 'meta' => $xmpmeta);
+ // Get XMP metadata into the object.
+ if ($xmpfiles->GetXMP($xmpmeta)) {
+ return array('files' => $xmpfiles, 'meta' => $xmpmeta);
+ }
+
+ // No XMP data available.
+ return FALSE;
}
/**
@@ -309,6 +317,11 @@ Class Exif {
'ns' => 'http://ns.adobe.com/photoshop/1.0/',
'type' => 'property',
),
+ 'source' => array(
+ 'name' => 'Source',
+ 'ns' => 'http://ns.adobe.com/photoshop/1.0/',
+ 'type' => 'property',
+ ),
'instructions' => array(
'name' => 'Instructions',
'ns' => 'http://ns.adobe.com/photoshop/1.0/',
@@ -334,6 +347,11 @@ Class Exif {
'ns' => 'http://purl.org/dc/elements/1.1/',
'type' => 'array',
),
+ 'title' => array(
+ 'name' => 'title',
+ 'ns' => 'http://purl.org/dc/elements/1.1/',
+ 'type' => 'array',
+ ),
'ciadrextadr' => array(
'name' => 'CiAdrExtadr',
'ns' => 'http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/',
@@ -357,6 +375,11 @@ Class Exif {
'ns' => 'http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/',
'type' => 'array',
),
+ 'subjectcode' => array(
+ 'name' => 'SubjectCode',
+ 'ns' => 'http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/',
+ 'type' => 'array',
+ ),
'hierarchicalsubject' => array(
'name' => 'hierarchicalSubject',
'ns' => 'http://ns.adobe.com/lightroom/1.0/',