370 lines
20 KiB
PHP
370 lines
20 KiB
PHP
<?php
|
|
|
|
/*
|
|
* PEL: PHP Exif Library. A library with support for reading and
|
|
* writing all Exif headers in JPEG and TIFF images using PHP.
|
|
*
|
|
* Copyright (C) 2005, 2006 Martin Geisler.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program in the file COPYING; if not, write to the
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
* Boston, MA 02110-1301 USA
|
|
*/
|
|
namespace Pel\Test\imagetests;
|
|
|
|
use lsolesen\pel\Pel;
|
|
use lsolesen\pel\PelJpeg;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class SonyDscV1Test extends TestCase
|
|
{
|
|
|
|
public function testRead()
|
|
{
|
|
Pel::clearExceptions();
|
|
Pel::setStrictParsing(false);
|
|
$jpeg = new PelJpeg(dirname(__FILE__) . '/sony-dsc-v1.jpg');
|
|
|
|
$exif = $jpeg->getExif();
|
|
$this->assertInstanceOf('lsolesen\pel\PelExif', $exif);
|
|
|
|
$tiff = $exif->getTiff();
|
|
$this->assertInstanceOf('lsolesen\pel\PelTiff', $tiff);
|
|
|
|
/* The first IFD. */
|
|
$ifd0 = $tiff->getIfd();
|
|
$this->assertInstanceOf('lsolesen\pel\PelIfd', $ifd0);
|
|
|
|
/* Start of IDF $ifd0. */
|
|
$this->assertEquals(count($ifd0->getEntries()), 10);
|
|
|
|
$entry = $ifd0->getEntry(270); // ImageDescription
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryAscii', $entry);
|
|
$this->assertEquals($entry->getValue(), ' ');
|
|
$this->assertEquals($entry->getText(), ' ');
|
|
|
|
$entry = $ifd0->getEntry(271); // Make
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryAscii', $entry);
|
|
$this->assertEquals($entry->getValue(), 'SONY');
|
|
$this->assertEquals($entry->getText(), 'SONY');
|
|
|
|
$entry = $ifd0->getEntry(272); // Model
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryAscii', $entry);
|
|
$this->assertEquals($entry->getValue(), 'DSC-V1');
|
|
$this->assertEquals($entry->getText(), 'DSC-V1');
|
|
|
|
$entry = $ifd0->getEntry(274); // Orientation
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 6);
|
|
$this->assertEquals($entry->getText(), 'right - top');
|
|
|
|
$entry = $ifd0->getEntry(282); // XResolution
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 72,
|
|
1 => 1
|
|
]);
|
|
$this->assertEquals($entry->getText(), '72/1');
|
|
|
|
$entry = $ifd0->getEntry(283); // YResolution
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 72,
|
|
1 => 1
|
|
]);
|
|
$this->assertEquals($entry->getText(), '72/1');
|
|
|
|
$entry = $ifd0->getEntry(296); // ResolutionUnit
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 2);
|
|
$this->assertEquals($entry->getText(), 'Inch');
|
|
|
|
$entry = $ifd0->getEntry(306); // DateTime
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryTime', $entry);
|
|
$this->assertEquals($entry->getValue(), 1089482993);
|
|
$this->assertEquals($entry->getText(), '2004:07:10 18:09:53');
|
|
|
|
$entry = $ifd0->getEntry(531); // YCbCrPositioning
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 2);
|
|
$this->assertEquals($entry->getText(), 'co-sited');
|
|
|
|
$entry = $ifd0->getEntry(50341); // PrintIM
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryUndefined', $entry);
|
|
$this->assertEquals($entry->getValue(), "\x50\x72\x69\x6e\x74\x49\x4d\0\x30\x32\x35\x30\0\0\x02\0\x02\0\x01\0\0\0\x01\x01\0\0\0\0");
|
|
$this->assertEquals($entry->getText(), '(undefined)');
|
|
|
|
/* Sub IFDs of $ifd0. */
|
|
$this->assertEquals(count($ifd0->getSubIfds()), 1);
|
|
$ifd0_0 = $ifd0->getSubIfd(2); // IFD Exif
|
|
$this->assertInstanceOf('lsolesen\pel\PelIfd', $ifd0_0);
|
|
|
|
/* Start of IDF $ifd0_0. */
|
|
$this->assertEquals(count($ifd0_0->getEntries()), 26);
|
|
|
|
$entry = $ifd0_0->getEntry(33434); // ExposureTime
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 10,
|
|
1 => 600
|
|
]);
|
|
$this->assertEquals($entry->getText(), '1/60 sec.');
|
|
|
|
$entry = $ifd0_0->getEntry(33437); // FNumber
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 32,
|
|
1 => 10
|
|
]);
|
|
$this->assertEquals($entry->getText(), 'f/3.2');
|
|
|
|
$entry = $ifd0_0->getEntry(34850); // ExposureProgram
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 2);
|
|
$this->assertEquals($entry->getText(), 'Normal program');
|
|
|
|
$entry = $ifd0_0->getEntry(34855); // ISOSpeedRatings
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 100);
|
|
$this->assertEquals($entry->getText(), '100');
|
|
|
|
$entry = $ifd0_0->getEntry(36864); // ExifVersion
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryVersion', $entry);
|
|
$this->assertEquals($entry->getValue(), 2.2);
|
|
$this->assertEquals($entry->getText(), 'Exif Version 2.2');
|
|
|
|
$entry = $ifd0_0->getEntry(36867); // DateTimeOriginal
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryTime', $entry);
|
|
$this->assertEquals($entry->getValue(), 1089482993);
|
|
$this->assertEquals($entry->getText(), '2004:07:10 18:09:53');
|
|
|
|
$entry = $ifd0_0->getEntry(36868); // DateTimeDigitized
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryTime', $entry);
|
|
$this->assertEquals($entry->getValue(), 1089482993);
|
|
$this->assertEquals($entry->getText(), '2004:07:10 18:09:53');
|
|
|
|
$entry = $ifd0_0->getEntry(37121); // ComponentsConfiguration
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryUndefined', $entry);
|
|
$this->assertEquals($entry->getValue(), "\x01\x02\x03\0");
|
|
$this->assertEquals($entry->getText(), 'Y Cb Cr -');
|
|
|
|
$entry = $ifd0_0->getEntry(37122); // CompressedBitsPerPixel
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 2,
|
|
1 => 1
|
|
]);
|
|
$this->assertEquals($entry->getText(), '2/1');
|
|
|
|
$entry = $ifd0_0->getEntry(37380); // ExposureBiasValue
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntrySRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 7,
|
|
1 => 10
|
|
]);
|
|
$this->assertEquals($entry->getText(), '+0.7');
|
|
|
|
$entry = $ifd0_0->getEntry(37381); // MaxApertureValue
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 48,
|
|
1 => 16
|
|
]);
|
|
$this->assertEquals($entry->getText(), '48/16');
|
|
|
|
$entry = $ifd0_0->getEntry(37383); // MeteringMode
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 2);
|
|
$this->assertEquals($entry->getText(), 'Center-Weighted Average');
|
|
|
|
$entry = $ifd0_0->getEntry(37384); // LightSource
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 0);
|
|
$this->assertEquals($entry->getText(), 'Unknown');
|
|
|
|
$entry = $ifd0_0->getEntry(37385); // Flash
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 31);
|
|
$this->assertEquals($entry->getText(), 'Flash fired, auto mode, return light detected.');
|
|
|
|
$entry = $ifd0_0->getEntry(37386); // FocalLength
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 139,
|
|
1 => 10
|
|
]);
|
|
$this->assertEquals($entry->getText(), '13.9 mm');
|
|
|
|
$entry = $ifd0_0->getEntry(37500); // MakerNote
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryUndefined', $entry);
|
|
$expected = "\x53\x4f\x4e\x59\x20\x44\x53\x43\x20\0\0\0\x0c\0\x01\x90\x07\0\x94\0\0\0\x40\x03\0\0\x02\x90\x07\0\xc8\0\0\0\xd4\x03\0\0\x03\x90\x07\0\xc8\0\0\0\x9c\x04\0\0\x04\x90\x07\0\x1a\0\0\0\x64\x05\0\0\x05\x90\x07\0\x78\0\0\0\x7e\x05\0\0\x06\x90\x07\0\xfc\0\0\0\xf6\x05\0\0\x07\x90\x07\0\xc8\0\0\0\xf2\x06\0\0\x08\x90\x07\0\xc8\0\0\0\xba\x07\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xdf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\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0\x40\x43\x7d\x40\x7d\x54\xd8\x54\xe7\xea\x70\xc7\x05\x07\x5e\xe1\x0e\xa8\x56\xa4\x05\x80\x70\xc7\x70\xc7\x05\x80\x56\x0d\0\xa3\x30\x63\xbe\xd8\xbe\x5b\xbe\x9e\xbe\x21\xd7\x96\xd7\x86\xd7\x22\xbe\x21\xd7\xb6\xd7\xef\xd7\x74\xd7\xd4\xd7\xb3\xd7\xa7\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
|
$this->assertEquals($entry->getValue(), $expected);
|
|
$this->assertEquals($entry->getText(), '1504 bytes unknown MakerNote data');
|
|
|
|
$entry = $ifd0_0->getEntry(40960); // FlashPixVersion
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryVersion', $entry);
|
|
$this->assertEquals($entry->getValue(), 1);
|
|
$this->assertEquals($entry->getText(), 'FlashPix Version 1.0');
|
|
|
|
$entry = $ifd0_0->getEntry(40961); // ColorSpace
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 1);
|
|
$this->assertEquals($entry->getText(), 'sRGB');
|
|
|
|
$entry = $ifd0_0->getEntry(40962); // PixelXDimension
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryLong', $entry);
|
|
$this->assertEquals($entry->getValue(), 640);
|
|
$this->assertEquals($entry->getText(), '640');
|
|
|
|
$entry = $ifd0_0->getEntry(40963); // PixelYDimension
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryLong', $entry);
|
|
$this->assertEquals($entry->getValue(), 480);
|
|
$this->assertEquals($entry->getText(), '480');
|
|
|
|
$entry = $ifd0_0->getEntry(41728); // FileSource
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryUndefined', $entry);
|
|
$this->assertEquals($entry->getValue(), "\x03");
|
|
$this->assertEquals($entry->getText(), 'DSC');
|
|
|
|
$entry = $ifd0_0->getEntry(41729); // SceneType
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryUndefined', $entry);
|
|
$this->assertEquals($entry->getValue(), "\x01");
|
|
$this->assertEquals($entry->getText(), 'Directly photographed');
|
|
|
|
$entry = $ifd0_0->getEntry(41985); // CustomRendered
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 0);
|
|
$this->assertEquals($entry->getText(), 'Normal process');
|
|
|
|
$entry = $ifd0_0->getEntry(41986); // ExposureMode
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 1);
|
|
$this->assertEquals($entry->getText(), 'Manual exposure');
|
|
|
|
$entry = $ifd0_0->getEntry(41987); // WhiteBalance
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 0);
|
|
$this->assertEquals($entry->getText(), 'Auto white balance');
|
|
|
|
$entry = $ifd0_0->getEntry(41990); // SceneCaptureType
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 0);
|
|
$this->assertEquals($entry->getText(), 'Standard');
|
|
|
|
/* Sub IFDs of $ifd0_0. */
|
|
$this->assertEquals(count($ifd0_0->getSubIfds()), 1);
|
|
$ifd0_0_0 = $ifd0_0->getSubIfd(4); // IFD Interoperability
|
|
$this->assertInstanceOf('lsolesen\pel\PelIfd', $ifd0_0_0);
|
|
|
|
/* Start of IDF $ifd0_0_0. */
|
|
$this->assertEquals(count($ifd0_0_0->getEntries()), 2);
|
|
|
|
$entry = $ifd0_0_0->getEntry(1); // InteroperabilityIndex
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryAscii', $entry);
|
|
$this->assertEquals($entry->getValue(), 'R98');
|
|
$this->assertEquals($entry->getText(), 'R98');
|
|
|
|
$entry = $ifd0_0_0->getEntry(2); // InteroperabilityVersion
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryVersion', $entry);
|
|
$this->assertEquals($entry->getValue(), 1);
|
|
$this->assertEquals($entry->getText(), 'Interoperability Version 1.0');
|
|
|
|
/* Sub IFDs of $ifd0_0_0. */
|
|
$this->assertEquals(count($ifd0_0_0->getSubIfds()), 0);
|
|
|
|
$this->assertEquals($ifd0_0_0->getThumbnailData(), '');
|
|
|
|
/* Next IFD. */
|
|
$ifd0_0_1 = $ifd0_0_0->getNextIfd();
|
|
$this->assertNull($ifd0_0_1);
|
|
/* End of IFD $ifd0_0_0. */
|
|
|
|
$this->assertEquals($ifd0_0->getThumbnailData(), '');
|
|
|
|
/* Next IFD. */
|
|
$ifd0_1 = $ifd0_0->getNextIfd();
|
|
$this->assertNull($ifd0_1);
|
|
/* End of IFD $ifd0_0. */
|
|
|
|
$this->assertEquals($ifd0->getThumbnailData(), '');
|
|
|
|
/* Next IFD. */
|
|
$ifd1 = $ifd0->getNextIfd();
|
|
$this->assertInstanceOf('lsolesen\pel\PelIfd', $ifd1);
|
|
/* End of IFD $ifd0. */
|
|
|
|
/* Start of IDF $ifd1. */
|
|
$this->assertEquals(count($ifd1->getEntries()), 8);
|
|
|
|
$entry = $ifd1->getEntry(259); // Compression
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 6);
|
|
$this->assertEquals($entry->getText(), 'JPEG compression');
|
|
|
|
$entry = $ifd1->getEntry(271); // Make
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryAscii', $entry);
|
|
$this->assertEquals($entry->getValue(), 'SONY');
|
|
$this->assertEquals($entry->getText(), 'SONY');
|
|
|
|
$entry = $ifd1->getEntry(272); // Model
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryAscii', $entry);
|
|
$this->assertEquals($entry->getValue(), 'DSC-V1');
|
|
$this->assertEquals($entry->getText(), 'DSC-V1');
|
|
|
|
$entry = $ifd1->getEntry(274); // Orientation
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 6);
|
|
$this->assertEquals($entry->getText(), 'right - top');
|
|
|
|
$entry = $ifd1->getEntry(282); // XResolution
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 72,
|
|
1 => 1
|
|
]);
|
|
$this->assertEquals($entry->getText(), '72/1');
|
|
|
|
$entry = $ifd1->getEntry(283); // YResolution
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
|
|
$this->assertEquals($entry->getValue(), [
|
|
0 => 72,
|
|
1 => 1
|
|
]);
|
|
$this->assertEquals($entry->getText(), '72/1');
|
|
|
|
$entry = $ifd1->getEntry(296); // ResolutionUnit
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
|
|
$this->assertEquals($entry->getValue(), 2);
|
|
$this->assertEquals($entry->getText(), 'Inch');
|
|
|
|
$entry = $ifd1->getEntry(306); // DateTime
|
|
$this->assertInstanceOf('lsolesen\pel\PelEntryTime', $entry);
|
|
$this->assertEquals($entry->getValue(), 1089482993);
|
|
$this->assertEquals($entry->getText(), '2004:07:10 18:09:53');
|
|
|
|
/* Sub IFDs of $ifd1. */
|
|
$this->assertEquals(count($ifd1->getSubIfds()), 0);
|
|
|
|
$thumb_data = file_get_contents(dirname(__FILE__) . '/sony-dsc-v1-thumb.jpg');
|
|
$this->assertEquals($ifd1->getThumbnailData(), $thumb_data);
|
|
|
|
/* Next IFD. */
|
|
$ifd2 = $ifd1->getNextIfd();
|
|
$this->assertNull($ifd2);
|
|
/* End of IFD $ifd1. */
|
|
|
|
$this->assertTrue(count(Pel::getExceptions()) == 0);
|
|
}
|
|
}
|