Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 882 Bytes

usage.md

File metadata and controls

38 lines (27 loc) · 882 Bytes

Usage

Using factory method

<?php
// reader with Native adapter
$reader = \PHPExif\Reader\Reader::factory(\PHPExif\Enum\ReaderType::NATIVE);

// reader with Exiftool adapter
//$reader = \PHPExif\Reader\Reader::factory(\PHPExif\Enum\ReaderType::EXIFTOOL);

// reader with FFmpeg/FFprobe adapter
//$reader = \PHPExif\Reader\Reader::factory(\PHPExif\Enum\ReaderType::FFPROBE);

// reader with Imagick adapter
//$reader = \PHPExif\Reader\Reader::factory(\PHPExif\Enum\ReaderType::IMAGICK);

$exif = $reader->read('/path/to/file');

echo 'Title: ' . $exif->getTitle() . PHP_EOL;

Using custom options

<?php
$adapter = new \PHPExif\Adapter\Exiftool(
    array(
        'toolPath'  => '/path/to/exiftool',
    )
);
$reader = new \PHPExif\Reader\Reader($adapter);

$exif = $reader->read('/path/to/file');

echo 'Title: ' . $exif->getTitle() . PHP_EOL;