PHP code example of vvval / exiftool-reader

1. Go to this page and download the library: Download vvval/exiftool-reader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vvval / exiftool-reader example snippets



$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' => '...']