You are here

public function Exif::readXMPTags in Exif 6

Read XMP data from an image file.

@todo Support for different array keys.

Parameters

$file: File path.

$arTagNames: Available metadata fields.

Return value

XMP image metadata.

File

./exif.class.php, line 162

Class

Exif
@author Raphael Schär This is a helper class to handle the whole data processing of exif

Code

public function readXMPTags($file, $arTagNames = array()) {

  // Get a CCK-XMP mapping.
  $map = $this
    ->getXMPFields();
  $xmp = $this
    ->openXMP($file);
  $info = array();
  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);
  }
  return $info;
}