You are here

public function Exif::readXMPItem in Exif 6

Read a single item from an image file.

Parameters

$xmp: XMP array as returned from openXMP().

$config: XMP field configuration.

$key: In case of array field type, the numeric field key.

Return value

Field value.

1 call to Exif::readXMPItem()
Exif::readXMPTags in ./exif.class.php
Read XMP data from an image file.

File

./exif.class.php, line 240

Class

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

Code

public function readXMPItem($xmp, $config, $key = 0) {

  // Setup.
  $xmpfiles = $xmp['files'];
  $xmpmeta = $xmp['meta'];

  // Try to read XMP data if the namespace is available.
  if (@$xmpmeta
    ->GetNamespacePrefix($config['ns'])) {
    if ($config['type'] == 'property') {
      $value = @$xmpmeta
        ->GetProperty($config['ns'], $config['name']);
    }
    elseif ($config['type'] == 'array') {
      $value = @$xmpmeta
        ->GetArrayItem($key, $config['ns'], $config['name']);
    }
    elseif ($config['type'] == 'struct') {
      $value = @$xmpmeta
        ->GetStructField($config['ns'], $config['struct'], $config['ns'], $config['name']);
    }
  }
  return $value;
}