'GPSLongitude' => array('description' => _("Longitude"), 'type' => 'gps'),
'LightSource' => array('description' => _("Light source"), 'type' => 'number'),
'FileSource' => array('description' => _("File source"), 'type' => 'number'),
+ 'Keywords' => array('description' => _("Image keywords"), 'type' => 'array')
);
}
// introduce a dependency on Horde_String to do the conversion).
$data = trim(substr($data, 7)) ;
+
default:
return !empty($data) ? $data : '---';
}
/* Special handling of GPS data */
if ($data['type'] == 'gps') {
- $value = self::_parseGPSData($exif[$field]);
- if (!empty($exif[$field . 'Ref']) && ($exif[$field . 'Ref'] == 'S' || $exif[$field . 'Ref'] == 'W')) {
+ $value = $this->_parseGPSData($exif[$field]);
+ if (!empty($exif[$field . 'Ref']) && ($exif[$field . 'Ref'] == 'S' ||
+ $exif[$field . 'Ref'] == 'South' ||
+ $exif[$field . 'Ref'] == 'W' ||
+ $exif[$field . 'Ref'] == 'West')) {
+
$value = '-' . $value;
}
}
{
// According to EXIF standard, GPS data can be in the form of
// dd/1 mm/1 ss/1 or as a decimal reprentation.
+ if (!is_array($data)) {
+ // Assume a scalar is a decimeal representation - but strip it of
+ // any stray characters that may be there.
+ return (double)trim(str_replace(array('N', 'S', 'E', 'W', '"'), array('', '', '', '', ''), $data));
+ }
if ($data[0] == 0) {
return 0;
}
public function getData($image)
{
// Request the full stream of meta data in JSON format.
- $command = '-j ' . $image;
+ $command = '-j -c "%.6f ' . $image;
$test = $this->_execute($command);
$results = json_decode($this->_execute($command));
- var_dump($results);
+ 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 $results;
+ return $this->_processData((array)$results);
}
- throw new Horde_Image_Exception('Unknown error running exiftool command.');
+ throw new Horde_Image_Exception('Unknown error running exiftool command');
+
}
/**