-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
118 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/php/Gomoob/MetadataExtractor/Metadata/Photoshop/DuckyDirectory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/** | ||
* gomoob/php-metadata-extractor | ||
* | ||
* @copyright Copyright (c) 2016, GOMOOB SARL (http://gomoob.com) | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE.md file) | ||
*/ | ||
namespace Gomoob\MetadataExtractor\Metadata\Photoshop; | ||
|
||
use Gomoob\MetadataExtractor\Metadata\Directory; | ||
use Gomoob\MetadataExtractor\Metadata\TagDescriptor; | ||
|
||
/** | ||
* Holds the data found in Photoshop "ducky" segments, created during Save-for-Web. | ||
* | ||
* @author Baptiste GAILLARD ([email protected]) | ||
*/ | ||
class DuckyDirectory extends Directory | ||
{ | ||
const TAG_QUALITY = 1; | ||
const TAG_COMMENT = 2; | ||
const TAG_COPYRIGHT = 3; | ||
|
||
private static $tagNameMap = [ | ||
self::TAG_QUALITY => 'Quality', | ||
self::TAG_COMMENT => 'Comment', | ||
self::TAG_COPYRIGHT => 'Copyright' | ||
]; | ||
|
||
public function __construct() | ||
{ | ||
$this->setDescriptor(new TagDescriptor($this)); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getName() | ||
{ | ||
return 'Ducky'; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function getTagNameMap() | ||
{ | ||
return static::$tagNameMap; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/test/php/Gomoob/MetadataExtractor/Imaging/ImageMetadataReader/SpongeBobHappyTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright 2016 SARL GOMOOB. All rights reserved. | ||
*/ | ||
namespace Gomoob\MetadataExtractor\Imaging\ImageMetadataReader; | ||
|
||
use Gomoob\MetadataExtractor\Imaging\ImageMetadataReader; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
use Gomoob\MetadataExtractor\Metadata\Jpeg\JpegDirectory; | ||
use Gomoob\MetadataExtractor\Metadata\Jfif\JfifDirectory; | ||
use Gomoob\MetadataExtractor\Metadata\Photoshop\DuckyDirectory; | ||
use Gomoob\MetadataExtractor\Metadata\Adobe\AdobeJpegDirectory; | ||
use Gomoob\MetadataExtractor\Metadata\File\FileMetadataDirectory; | ||
|
||
/** | ||
* Test case used to test the {@link ImageMetadataReader} class with the `spongebob_happy.jpg` test file. | ||
* | ||
* @author Baptiste GAILLARD ([email protected]) | ||
* @group ImageMetadataReader.SixteenColor10x10Test | ||
*/ | ||
class SpongeBobHappyTest extends TestCase | ||
{ | ||
/** | ||
* Test method for {@link ImageMetadataReader#readMetadata($file)} and `spongebob_happy.jpg`. | ||
*/ | ||
public function testReadMetadata() | ||
{ | ||
$metadata = ImageMetadataReader::readMetadata(realpath(TEST_RESOURCES_DIRECTORY . '/spongebob_happy.jpg')); | ||
|
||
// Checks 'JPEG' directory | ||
$directory = $metadata->getDirectories()[0]; | ||
$this->assertInstanceOf(JpegDirectory::class, $directory); | ||
|
||
// Checks 'JFIF' directory | ||
$directory = $metadata->getDirectories()[1]; | ||
$this->assertInstanceOf(JfifDirectory::class, $directory); | ||
|
||
// Checks 'Ducky' directory | ||
$directory = $metadata->getDirectories()[2]; | ||
$this->assertInstanceOf(DuckyDirectory::class, $directory); | ||
|
||
// Checks 'Adobe JPEG' directory | ||
$directory = $metadata->getDirectories()[3]; | ||
$this->assertInstanceOf(AdobeJpegDirectory::class, $directory); | ||
|
||
// Checks 'File' directory | ||
$directory = $metadata->getDirectories()[4]; | ||
$this->assertInstanceOf(FileMetadataDirectory::class, $directory); | ||
|
||
// TODO: Continue testing | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.