Skip to content

vvval/exiftool-reader

Repository files navigation

Exiftool reader process wrapper

A PHP wrapper to fetch data from exiftools util.

Latest Stable Version Total Downloads Scrutinizer Code Quality Build Status License Coverage Status

Installation

composer require vvval/exiftool-reader

Example usage

<?php
$exiftoolConfig = new \ExiftoolReader\Config\Exiftool();
$command = new \ExiftoolReader\Command($exiftoolConfig);
$mapperConfig = new \ExiftoolReader\Config\Mapper();
$utils = new \ExiftoolReader\Utils();

$reader = new \ExiftoolReader\Reader($command);
$metadata = new \ExiftoolReader\Metadata($mapperConfig, $utils);

/** @var ExiftoolReader\Result $output */
$output = $reader->read('filename');

/**
 * Full metadata array.
 */
$decoded = $output->getDecoded();
var_dump($decoded); // ['title' => '...', 'description' => '...', /* ... other fields */]

/**
 * Fetched specified metadata keys.
 * Uses aliases to find values,
 * for example Title|ObjectName, Description|Caption-Abstract|ImageDescription, etc...
 */
$fetchedData = $metadata->fetch($output, ['title', 'description']);
var_dump($fetchedData); // ['title' => '...', 'description' => '...']