Horde_Image_Exif::getCategories PHP Method

getCategories() public static method

Obtains an array of supported meta data fields.
public static getCategories ( ) : array
return array
    public static function getCategories()
    {
        return array('IPTC' => array('Keywords' => array('description' => Horde_Image_Translation::t("Image keywords"), 'type' => 'array'), 'ObjectName' => array('description' => Horde_Image_Translation::t("Image Title"), 'type' => 'text'), 'By-line' => array('description' => Horde_Image_Translation::t("By"), 'type' => 'text'), 'CopyrightNotice' => array('description' => Horde_Image_Translation::t("Copyright"), 'type' => 'text'), 'Caption-Abstract' => array('description' => Horde_Image_Translation::t("Caption"), 'type' => 'text')), 'XMP' => array('Creator' => array('description' => Horde_Image_Translation::t("Image Creator"), 'type' => 'text'), 'Rights' => array('description' => Horde_Image_Translation::t("Rights"), 'type' => 'text'), 'UsageTerms' => array('description' => Horde_Image_Translation::t("Usage Terms"), 'type' => 'text'), 'Title' => array('description' => Horde_Image_Translation::t("Title"), 'type' => 'text'), 'Description' => array('description' => Horde_Image_Translation::t("Description"), 'type' => 'text')), 'EXIF' => array('DateTime' => array('description' => Horde_Image_Translation::t("Date Photo Modified"), 'type' => 'date'), 'DateTimeOriginal' => array('description' => Horde_Image_Translation::t("Date Photo Taken"), 'type' => 'date'), 'DateTimeDigitized' => array('description' => Horde_Image_Translation::t("Date Photo Digitized"), 'type' => 'date'), 'GPSLatitude' => array('description' => Horde_Image_Translation::t("Latitude"), 'type' => 'gps'), 'GPSLongitude' => array('description' => Horde_Image_Translation::t("Longitude"), 'type' => 'gps'), 'Make' => array('description' => Horde_Image_Translation::t("Camera Make"), 'type' => 'text'), 'Model' => array('description' => Horde_Image_Translation::t("Camera Model"), 'type' => 'text'), 'Software' => array('description' => Horde_Image_Translation::t("Software Version"), 'type' => 'text'), 'ImageType' => array('description' => Horde_Image_Translation::t("Photo Type"), 'type' => 'text'), 'ImageDescription' => array('description' => Horde_Image_Translation::t("Photo Description"), 'type' => 'text'), 'FileSize' => array('description' => Horde_Image_Translation::t("File Size"), 'type' => 'number'), 'ExifImageWidth' => array('description' => Horde_Image_Translation::t("Width"), 'type' => 'number'), 'ExifImageLength' => array('description' => Horde_Image_Translation::t("Height"), 'type' => 'number'), 'XResolution' => array('description' => Horde_Image_Translation::t("X Resolution"), 'type' => 'number'), 'YResolution' => array('description' => Horde_Image_Translation::t("Y Resolution"), 'type' => 'number'), 'ResolutionUnit' => array('description' => Horde_Image_Translation::t("Resolution Unit"), 'type' => 'text'), 'ShutterSpeedValue' => array('description' => Horde_Image_Translation::t("Shutter Speed"), 'type' => 'number'), 'ExposureTime' => array('description' => Horde_Image_Translation::t("Exposure"), 'type' => 'number'), 'FocalLength' => array('description' => Horde_Image_Translation::t("Focal Length"), 'type' => 'number'), 'FocalLengthIn35mmFilm' => array('description' => Horde_Image_Translation::t("Focal Length (35mm equiv)"), 'type' => 'number'), 'ApertureValue' => array('description' => Horde_Image_Translation::t("Aperture"), 'type' => 'number'), 'FNumber' => array('description' => Horde_Image_Translation::t("F-Number"), 'type' => 'number'), 'ISOSpeedRatings' => array('description' => Horde_Image_Translation::t("ISO Setting"), 'type' => 'number'), 'ExposureBiasValue' => array('description' => Horde_Image_Translation::t("Exposure Bias"), 'type' => 'number'), 'ExposureMode' => array('description' => Horde_Image_Translation::t("Exposure Mode"), 'type' => 'number'), 'ExposureProgram' => array('description' => Horde_Image_Translation::t("Exposure Program"), 'type' => 'number'), 'MeteringMode' => array('description' => Horde_Image_Translation::t("Metering Mode"), 'type' => 'number'), 'Flash' => array('description' => Horde_Image_Translation::t("Flash Setting"), 'type' => 'number'), 'UserComment' => array('description' => Horde_Image_Translation::t("User Comment"), 'type' => 'text'), 'ColorSpace' => array('description' => Horde_Image_Translation::t("Color Space"), 'type' => 'number'), 'SensingMethod' => array('description' => Horde_Image_Translation::t("Sensing Method"), 'type' => 'number'), 'WhiteBalance' => array('description' => Horde_Image_Translation::t("White Balance"), 'type' => 'number'), 'Orientation' => array('description' => Horde_Image_Translation::t("Camera Orientation"), 'type' => 'number'), 'Copyright' => array('description' => Horde_Image_Translation::t("Copyright"), 'type' => 'text'), 'Artist' => array('description' => Horde_Image_Translation::t("Artist"), 'type' => 'text'), 'LightSource' => array('description' => Horde_Image_Translation::t("Light source"), 'type' => 'number'), 'ImageStabalization' => array('description' => Horde_Image_Translation::t("Image Stabilization"), 'type' => 'text'), 'SceneCaptureType' => array('description' => Horde_Image_Translation::t("Scene Type"), 'type' => 'number')), 'COMPOSITE' => array('LensID' => array('description' => Horde_Image_Translation::t("Lens Id"), 'type' => 'text'), 'Lens' => array('description' => 'Lens', 'type' => 'text'), 'Aperture' => array('description' => Horde_Image_Translation::t("Aperture"), 'type' => 'text'), 'DOF' => array('description' => Horde_Image_Translation::t("Depth of Field"), 'type' => 'text'), 'FOV' => array('description' => Horde_Image_Translation::t("Field of View"), 'type' => 'text')));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Get the image's EXIF data.
  *
  * @param string $image  The path to an image.
  *
  * @return array  The exif data.
  */
 public function getData($image)
 {
     // Request the full stream of meta data in JSON format.
     // -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;
     $this->_logDebug('Command executed by Exiftool: ' . $command);
     $results = json_decode($this->_execute($command));
     $this->_logDebug('Results of Exiftool command: ' . print_r($results, true));
     if (is_array($results)) {
         return $this->_processData((array) array_pop($results));
     }
     throw new Horde_Image_Exception('Unknown error running exiftool command');
 }