Skip to content

Commit

Permalink
Merge pull request #4 from joserick/master
Browse files Browse the repository at this point in the history
[pull] master from joserick:master
  • Loading branch information
janbarasek authored Sep 9, 2021
2 parents 5d7070c + e4972a2 commit 6b39a9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ echo $png_metadata->get('exif:DateTime'); // Return a value, a array or false.

### Example 3 - Types

Print the metadata types (IHDR, SRBG, BKGD, EXIF, XMP, CRS, DATE, DC, ICC, AUX, ...).
Print the metadata types (IHDR, sRGB, BKGD, EXIF, XMP, CRS, DATE, DC, ICC, AUX, ...).

```php
$png_metadata = new PNGMetadata('./Path/Photo.png');
Expand Down
12 changes: 6 additions & 6 deletions src/PNGMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* PNG Metadata class for extraction of XMP, TEXIF, EXIF, BKGD, RBG and IHDR.
* PNG Metadata class for extraction of XMP, TEXIF, EXIF, BKGD, sRGB and IHDR.
*
* Returns the complete information found in the different types
* of metadata within a PNG format image.
Expand Down Expand Up @@ -91,7 +91,7 @@ public function __construct(string $path)
$this->extractTExif();
$this->extractExif();
$this->extractBKGD();
$this->extractRBG();
$this->extractRGB();
$this->extractIHDR();
ksort($this->metadata);

Expand Down Expand Up @@ -438,17 +438,17 @@ private function extractBKGD(): void


/**
* Extract RBG type from sRBG chunk as a array.
* Extract RGB type from sRGB chunk as a array.
*
* @see PNGMetadata::$metadata For the property whose metadata are storage.
* @see PNGMetadata::$chunks For the property whose chunks data are storage.
*/
private function extractRBG(): void
private function extractRGB(): void
{
if (isset($this->chunks['sRGB'])) {
$rbg = ['Perceptual', 'Relative Colorimetric', 'Saturation', 'Absolute Colorimetric'];
$rgb = ['Perceptual', 'Relative Colorimetric', 'Saturation', 'Absolute Colorimetric'];
$unpacked = unpack('C', $this->chunks['sRGB']);
$this->metadata['sRBG'] = $rbg[end(...$unpacked)];
$this->metadata['sRGB'] = $rgb[end($unpacked)] ?? 'Unknown';
}
}

Expand Down

0 comments on commit 6b39a9e

Please sign in to comment.