You are here

function Exif::openXMP in Exif 6

Open an image file for XMP data extraction.

Parameters

$file: File path.

Return value

Array with XMP file and metadata.

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

File

./exif.class.php, line 194

Class

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

Code

function openXMP($file) {

  // Setup.
  SXMPFiles::Initialize();
  $xmpfiles = new SXMPFiles();
  $xmpmeta = new SXMPMeta();

  // Open.
  $xmpfiles
    ->OpenFile($file);

  // Get XMP metadata into the object.
  if ($xmpfiles
    ->GetXMP($xmpmeta)) {

    // Sort metadata.
    $xmpmeta
      ->Sort();
    return array(
      'files' => $xmpfiles,
      'meta' => $xmpmeta,
    );
  }

  // No XMP data available.
  return FALSE;
}