PHP code example of frameright / image-metadata-parser

1. Go to this page and download the library: Download frameright/image-metadata-parser 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/ */

    

frameright / image-metadata-parser example snippets


$image = Image::fromFile($filename);

$headline = $image->getXmp()->getHeadline();
$camera = $image->getExif()->getCamera();
...

$jpeg = JPEG::fromFile('image.jpg');
$png = PNG::fromFile('image.png');

$data = ...

$jpeg = JPEG::fromString($data);

$gd = imagecreate(100, 100);
$jpeg = JPEG::fromResource($gd);

$stream = fopen('...', 'r+');
$jpeg = JPEG::fromStream($stream);

$image = Image::fromFile($filename);
$headline = $image->getAggregate()->getHeadline();

$aggregate = $image->getAggregate();
$aggregate->setPriority(['exif', 'iptc', 'xmp']);

$aggregate->getHeadline(); // will now check EXIF first, then IPTC, then XMP

$aggregate->setPriority(['iptc', 'xmp']);
$aggregate->getHeadline(); // will only check IPTC and XMP

$image = ...
$gps = $image->getAggregateMeta()->getGPS(); // checks EXIF and XMP
// or $gps = $image->getExif()->getGPS();

$lat = $gps->getLatitude();