Add some missing exif fields and start adding support for composite fields. We store the composite fields already parsed
to both take advantage of exiftool's parsing, as well as to avoid issues with different maker formats.
Now if only Aperture wouldn't nuke most of these fields...
'Artist' => array('description' => _("Artist"), 'type' => 'text'),
'LightSource' => array('description' => _("Light source"), 'type' => 'number'),
'ImageStabalization' => array('description' => _("Image Stabilization"), 'type' => 'text'),
+ 'SceneCaptureType' => array('description' => _("Scene Type"), 'type' => 'number'),
+
),
+
+ 'COMPOSITE' => array(
+ 'LensID' => array('description' => _("Lens"), 'type' => 'text'),
+ 'Aperture' => array('description' => _("Aperture"), 'type' => 'text'),
+ 'DOF' => array('description' => _("Depth of Field"), 'type' => 'text'),
+ 'FOV' => array('description' => _("Field of View"), 'type' => 'text')
+ )
);
}
if ($driver instanceof Horde_Image_Exif_Base) {
$supported = $driver->supportedCategories();
} else {
- $supported = array('XMP', 'IPTC', 'EXIF');
+ $supported = array('XMP', 'IPTC', 'EXIF' );
}
$categories = self::getCategories();
$flattened = array();
default: return _("Uncalibrated");
}
+ case 'SceneCaptureType':
+ switch ($data) {
+ case 0: return _("Standard");
+ case 1: return _("Landscape");
+ case 2: return _("Portrait");
+ case 3: return _("Night Scene");
+ default: return _("Unknown");
+ }
+
case 'DateTime':
case 'DateTimeOriginal':
case 'DateTimeDigitized':
{
$results = array();
if ($exif) {
- $fields = Horde_Image_Exif::getFields();
-
+ $fields = Horde_Image_Exif::getFields($this);
foreach ($fields as $field => $data) {
$value = isset($exif[$field]) ? $exif[$field] : '';
// Don't store empty fields.
public function getData($image)
{
// Request the full stream of meta data in JSON format.
- // -j option outputs in JSON, -n = prevent screen formatting
- // -x DataDump prevents the binary DataDump field from some cameras from
- // being included. It messes up the JSON decoding, and it's not used
- // anywhere anyway.
- $command = '-j -n -x MakerNotes:DataDump ' . $image;
+ // -j option outputs in JSON, appending '#' to the -TAG prevents
+ // screen formatting.
+ $categories = Horde_Image_Exif::getCategories();
+ $tags = '';
+ foreach (array('EXIF', 'IPTC', 'XMP') as $category) {
+ foreach ($categories[$category] as $field => $value) {
+ $tags .= ' -' . $field . '#';
+ }
+ }
+ foreach ($categories['COMPOSITE'] as $field => $value) {
+ $tags .= ' -' . $field;
+ }
+ $command = '-j' . $tags . ' ' . $image;
$results = json_decode($this->_execute($command));
if (is_array($results)) {
- $results = array_pop($results);
- }
- // Return as an array since that's what all the other Exif classes do...
- if ($results instanceof stdClass) {
- return $this->_processData((array)$results);
+ $exif_results = $this->_processData((array)array_pop($results));
+ return $exif_results;
}
throw new Horde_Image_Exception('Unknown error running exiftool command');
-
}
public function supportedCategories()
{
- return array('EXIF', 'IPTC', 'XMP');
+ return array('EXIF', 'IPTC', 'XMP', 'COMPOSITE');
}
/**