pel / pel

PHP Exif Library - library for reading and writing Exif headers in JPEG and TIFF files using PHP.

Home Page:https://github.com/pel/pel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EXIF value misses the last character

svenbluege opened this issue · comments

I use the following code snippet to read the camera model:

<?php

setlocale(LC_ALL, '');

require_once '../autoload.php';
use lsolesen\pel\PelDataWindow;
use lsolesen\pel\PelJpeg;
use lsolesen\pel\PelTiff;
use lsolesen\pel\Pel;
use lsolesen\pel\PelTag;

$prog = array_shift($argv);
$file = $argv[0];;
Pel::setDebug(true);


$input_jpeg = new PelJpeg($file);

$app1 = $input_jpeg->getExif();

$tiff = $app1->getTiff();
$ifd0 = $tiff->getIfd();
echo $ifd0->getEntry(PelTag::MODEL);

The code returns this for the attached image file:

/> php dump-image.php D:\temp\event\test7\20161125_124812_p4101ldrnightstrong.jpg
  Tag: 0x0110 (Model)
    Format    : 2 (Ascii)
    Components: 21
    Value     : Canon EOS 5D Mark II
    Text      : Canon EOS 5D Mark II

As you can see, it states a Canon 5D Mark II but actually it is a 5D MK III. The last character got lost somehow. The same file works fine in other exif tools:

image

Do you have any clue what is wrong here? I'm a bit clueless here.

20161125_124812_p4101ldrnightstrong

Could you make a pull request with your Test?

on its way :)

Awesome! Thank you!