Beispiel #1
0
 public function __construct($min, $max)
 {
     Pel::setStrictParsing(true);
     $this->min = $min;
     $this->max = $max;
     parent::__construct('PEL Exif Number Tests');
 }
Beispiel #2
0
 public function testRead()
 {
     Pel::clearExceptions();
     Pel::setStrictParsing(false);
     $jpeg = new PelJpeg(dirname(__FILE__) . '/no-exif.jpg');
     $exif = $jpeg->getExif();
     $this->assertNull($exif);
     $this->assertTrue(count(Pel::getExceptions()) == 0);
 }
Beispiel #3
0
 public function testRead()
 {
     Pel::clearExceptions();
     Pel::setStrictParsing(false);
     $jpeg = new PelJpeg(dirname(__FILE__) . '/nikon-coolscan-iv.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()), 6);
     $entry = $ifd0->getEntry(271);
     // Make
     $this->assertInstanceOf('lsolesen\\pel\\PelEntryAscii', $entry);
     $this->assertEquals($entry->getValue(), 'Nikon');
     $this->assertEquals($entry->getText(), 'Nikon');
     $entry = $ifd0->getEntry(282);
     // XResolution
     $this->assertInstanceOf('lsolesen\\pel\\PelEntryRational', $entry);
     $this->assertEquals($entry->getValue(), array(0 => 2000, 1 => 1));
     $this->assertEquals($entry->getText(), '2000/1');
     $entry = $ifd0->getEntry(283);
     // YResolution
     $this->assertInstanceOf('lsolesen\\pel\\PelEntryRational', $entry);
     $this->assertEquals($entry->getValue(), array(0 => 2000, 1 => 1));
     $this->assertEquals($entry->getText(), '2000/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(), 1090023875);
     $this->assertEquals($entry->getText(), '2004:07:17 00:24:35');
     $entry = $ifd0->getEntry(531);
     // YCbCrPositioning
     $this->assertInstanceOf('lsolesen\\pel\\PelEntryShort', $entry);
     $this->assertEquals($entry->getValue(), 1);
     $this->assertEquals($entry->getText(), 'centered');
     /* Sub IFDs of $ifd0. */
     $this->assertEquals(count($ifd0->getSubIfds()), 2);
     $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()), 7);
     $entry = $ifd0_0->getEntry(36864);
     // ExifVersion
     $this->assertInstanceOf('lsolesen\\pel\\PelEntryVersion', $entry);
     $this->assertEquals($entry->getValue(), 2.1);
     $this->assertEquals($entry->getText(), 'Exif Version 2.1');
     $entry = $ifd0_0->getEntry(37121);
     // ComponentsConfiguration
     $this->assertInstanceOf('lsolesen\\pel\\PelEntryUndefined', $entry);
     $this->assertEquals($entry->getValue(), "");
     $this->assertEquals($entry->getText(), 'Y Cb Cr -');
     $entry = $ifd0_0->getEntry(37500);
     // MakerNote
     $this->assertInstanceOf('lsolesen\\pel\\PelEntryUndefined', $entry);
     $expected = "0100";
     $this->assertEquals($entry->getValue(), $expected);
     $this->assertEquals($entry->getText(), '32 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(), 960);
     $this->assertEquals($entry->getText(), '960');
     $entry = $ifd0_0->getEntry(40963);
     // PixelYDimension
     $this->assertInstanceOf('lsolesen\\pel\\PelEntryLong', $entry);
     $this->assertEquals($entry->getValue(), 755);
     $this->assertEquals($entry->getText(), '755');
     /* Sub IFDs of $ifd0_0. */
     $this->assertEquals(count($ifd0_0->getSubIfds()), 0);
     $this->assertEquals($ifd0_0->getThumbnailData(), '');
     /* Next IFD. */
     $ifd0_1 = $ifd0_0->getNextIfd();
     $this->assertNull($ifd0_1);
     /* End of IFD $ifd0_0. */
     $ifd0_1 = $ifd0->getSubIfd(3);
     // IFD GPS
     $this->assertInstanceOf('lsolesen\\pel\\PelIfd', $ifd0_1);
     /* Start of IDF $ifd0_1. */
     $this->assertEquals(count($ifd0_1->getEntries()), 0);
     /* Sub IFDs of $ifd0_1. */
     $this->assertEquals(count($ifd0_1->getSubIfds()), 0);
     $this->assertEquals($ifd0_1->getThumbnailData(), '');
     /* Next IFD. */
     $ifd0_2 = $ifd0_1->getNextIfd();
     $this->assertNull($ifd0_2);
     /* End of IFD $ifd0_1. */
     $this->assertEquals($ifd0->getThumbnailData(), '');
     /* Next IFD. */
     $ifd1 = $ifd0->getNextIfd();
     $this->assertNull($ifd1);
     /* End of IFD $ifd0. */
     $this->assertTrue(count(Pel::getExceptions()) == 0);
 }