Skip to content

Commit

Permalink
Added support for 'colortype' (romainneutron#2)
Browse files Browse the repository at this point in the history
* Added support for 'colortype'

- Added support for rgba

* Update Image.php

* Update Image.php

* Update Image.php
  • Loading branch information
KallooaSan authored and jygaulier committed Feb 20, 2018
1 parent 791adef commit 1c5c1b2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/MediaVorus/Media/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class Image extends DefaultMedia
* Colorspace constant Grayscale
*/
const COLORSPACE_GRAYSCALE = 'Grayscale';
/**
* Colorspace constant RGBA
*/
const COLORSPACE_RGBA = 'RGBA';

/**
* @VirtualProperty
Expand Down Expand Up @@ -356,7 +360,7 @@ public function getLightValue()
*/
public function getColorSpace()
{
$regexp = '/.*:(colorspace|colormode|colorspacedata)/i';
$regexp = '/.*:(colorspace|colormode|colorspacedata|colortype)/i';

foreach ($this->getMetadatas()->filterKeysByRegExp($regexp) as $meta) {
switch (strtolower(trim($meta->getValue()->asString()))) {
Expand All @@ -367,11 +371,17 @@ public function getColorSpace()
return self::COLORSPACE_SRGB;
break;
case 'rgb':
case '2':
return self::COLORSPACE_RGB;
break;
case 'grayscale':
case '0':
return self::COLORSPACE_GRAYSCALE;
break;
case 'rgba':
case '6':
return self::COLORSPACE_RGBA;
break;
}
}

Expand Down

0 comments on commit 1c5c1b2

Please sign in to comment.