Skip to content

Commit 4191eb3

Browse files
committed
Prepare version 2.9.1-alpha.4.
1 parent 125d55b commit 4191eb3

File tree

9 files changed

+118
-6
lines changed

9 files changed

+118
-6
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ The following builds are available :
8484

8585
## Release history
8686

87+
### 2.9.1-alpha.4 (2016-08-25)
88+
* Add `\Gomoob\MetadataExtractor\Metadata\Photoshop\DuckyDirectory` class.
89+
8790
### 2.9.1-alpha.3 (2016-08-25)
8891
* Add `\Gomoob\MetadataExtractor\Metadata\Bmp\BmpHeaderDescriptor` to begin management of BMP files ;
8992
* Add `\Gomoob\MetadataExtractor\Metadata\Bmp\BmpHeaderDirectory` to begin management of BMP files ;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name" : "gomoob/php-metadata-extractor",
33
"description" : "PHP wrapper to easily call the Java metadata-extrator library.",
4-
"version" : "2.9.1-alpha.3",
4+
"version" : "2.9.1-alpha.4",
55
"license" : "MIT",
66
"type" : "library",
77
"keywords" : [

composer.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gomoob-php-metadata-extractor",
3-
"version": "2.9.1-alpha.3",
3+
"version": "2.9.1-alpha.4",
44
"license": "MIT",
55
"repository" : {
66
"type" : "git",

src/main/php/Gomoob/MetadataExtractor/Imaging/ImageMetadataReader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
use Gomoob\MetadataExtractor\Metadata\Exif\Makernotes\CanonMakernoteDirectory;
3636
use Gomoob\MetadataExtractor\Metadata\Exif\GpsDirectory;
3737
use Gomoob\MetadataExtractor\Metadata\Png\PngDirectory;
38+
use Gomoob\MetadataExtractor\Metadata\Photoshop\DuckyDirectory;
3839

3940
/**
4041
* Reads metadata from any supported file format.
@@ -685,6 +686,9 @@ private static function createDirectoryWithName($directoryName)
685686
case 'Canon Makernote':
686687
$directory = new CanonMakernoteDirectory();
687688
break;
689+
case 'Ducky':
690+
$directory = new DuckyDirectory();
691+
break;
688692
case 'Exif IFD0':
689693
$directory = new ExifIFD0Directory();
690694
break;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/**
4+
* gomoob/php-metadata-extractor
5+
*
6+
* @copyright Copyright (c) 2016, GOMOOB SARL (http://gomoob.com)
7+
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE.md file)
8+
*/
9+
namespace Gomoob\MetadataExtractor\Metadata\Photoshop;
10+
11+
use Gomoob\MetadataExtractor\Metadata\Directory;
12+
use Gomoob\MetadataExtractor\Metadata\TagDescriptor;
13+
14+
/**
15+
* Holds the data found in Photoshop "ducky" segments, created during Save-for-Web.
16+
*
17+
* @author Baptiste GAILLARD ([email protected])
18+
*/
19+
class DuckyDirectory extends Directory
20+
{
21+
const TAG_QUALITY = 1;
22+
const TAG_COMMENT = 2;
23+
const TAG_COPYRIGHT = 3;
24+
25+
private static $tagNameMap = [
26+
self::TAG_QUALITY => 'Quality',
27+
self::TAG_COMMENT => 'Comment',
28+
self::TAG_COPYRIGHT => 'Copyright'
29+
];
30+
31+
public function __construct()
32+
{
33+
$this->setDescriptor(new TagDescriptor($this));
34+
}
35+
36+
/**
37+
* {@inheritDoc}
38+
*/
39+
public function getName()
40+
{
41+
return 'Ducky';
42+
}
43+
44+
/**
45+
* {@inheritDoc}
46+
*/
47+
protected function getTagNameMap()
48+
{
49+
return static::$tagNameMap;
50+
}
51+
}

src/test/php/Gomoob/MetadataExtractor/Imaging/ImageMetadataReader/SixteenColor10x10Test.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
/**
44
* Copyright 2016 SARL GOMOOB. All rights reserved.
5-
*/
5+
*/
66
namespace Gomoob\MetadataExtractor\Imaging\ImageMetadataReader;
77

88
use Gomoob\MetadataExtractor\Imaging\ImageMetadataReader;
99

1010
use PHPUnit\Framework\TestCase;
1111

12-
use Gomoob\MetadataExtractor\Metadata\Exif\ExifIFD0Directory;
1312
use Gomoob\MetadataExtractor\Metadata\Bmp\BmpHeaderDirectory;
1413
use Gomoob\MetadataExtractor\Metadata\File\FileMetadataDirectory;
1514

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
/**
4+
* Copyright 2016 SARL GOMOOB. All rights reserved.
5+
*/
6+
namespace Gomoob\MetadataExtractor\Imaging\ImageMetadataReader;
7+
8+
use Gomoob\MetadataExtractor\Imaging\ImageMetadataReader;
9+
10+
use PHPUnit\Framework\TestCase;
11+
12+
use Gomoob\MetadataExtractor\Metadata\Jpeg\JpegDirectory;
13+
use Gomoob\MetadataExtractor\Metadata\Jfif\JfifDirectory;
14+
use Gomoob\MetadataExtractor\Metadata\Photoshop\DuckyDirectory;
15+
use Gomoob\MetadataExtractor\Metadata\Adobe\AdobeJpegDirectory;
16+
use Gomoob\MetadataExtractor\Metadata\File\FileMetadataDirectory;
17+
18+
/**
19+
* Test case used to test the {@link ImageMetadataReader} class with the `spongebob_happy.jpg` test file.
20+
*
21+
* @author Baptiste GAILLARD ([email protected])
22+
* @group ImageMetadataReader.SixteenColor10x10Test
23+
*/
24+
class SpongeBobHappyTest extends TestCase
25+
{
26+
/**
27+
* Test method for {@link ImageMetadataReader#readMetadata($file)} and `spongebob_happy.jpg`.
28+
*/
29+
public function testReadMetadata()
30+
{
31+
$metadata = ImageMetadataReader::readMetadata(realpath(TEST_RESOURCES_DIRECTORY . '/spongebob_happy.jpg'));
32+
33+
// Checks 'JPEG' directory
34+
$directory = $metadata->getDirectories()[0];
35+
$this->assertInstanceOf(JpegDirectory::class, $directory);
36+
37+
// Checks 'JFIF' directory
38+
$directory = $metadata->getDirectories()[1];
39+
$this->assertInstanceOf(JfifDirectory::class, $directory);
40+
41+
// Checks 'Ducky' directory
42+
$directory = $metadata->getDirectories()[2];
43+
$this->assertInstanceOf(DuckyDirectory::class, $directory);
44+
45+
// Checks 'Adobe JPEG' directory
46+
$directory = $metadata->getDirectories()[3];
47+
$this->assertInstanceOf(AdobeJpegDirectory::class, $directory);
48+
49+
// Checks 'File' directory
50+
$directory = $metadata->getDirectories()[4];
51+
$this->assertInstanceOf(FileMetadataDirectory::class, $directory);
52+
53+
// TODO: Continue testing
54+
}
55+
}
9.98 KB
Loading

0 commit comments

Comments
 (0)