vvval/exiftool-reader

Exiftool reader 处理包装器

v0.0.11 2017-02-27 19:46 UTC

This package is auto-updated.

Last update: 2024-08-28 02:09:54 UTC


README

一个 PHP 包装器,用于从 exiftools 工具中获取数据。

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

安装

composer require vvval/exiftool-reader

示例用法

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