freeman / image-exif-reader
PHP Exif reader for images that ensures image path is not a URL
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2025-05-11 06:09:20 UTC
README
PHP exif wrapper that ensures image is valid and not a URL. Allows for fetching of single fields of exif data. PSR-4 compliant for easy autoloading.
Prerequisites
Usage
PHP 7.0^
Development
phpunit 6.1^
Installation
Use composer to install this library.
Either use CLI:
php composer.phar require "freeman/image-exif-reader"
or add it to your composer file:
"freeman/image-exif-reader": "^1.0"
Usage
Create a new instance of the ImageExifReader class provided in src
folder
$reader = new \Freeman\ImageExifReader\ImageExifReader();
To get an array of exif, use getExifData
.
$reader->getExifData($myImagePath);
If you only want the data from a specific key of the exif array, use getExifDataByKey
. For instance, if you wish to retrieve only the filename:
$reader->getExifDataByKey($myImage, 'FileName')
In both scenarios the call will return null if the image format is wrong, or the requested exif data does not exist.
In case the file does not exist an exception is thrown
Running tests
Image Exif Reader comes with phpunit tests and a phpunit.xml file.
Version History
1.0.0: Initial release on GitHub and Packagist
1.0.1: Readme updates only