PHRAS-1819: Lazaret checker colorspace add rga

Add support for rgba in colorspace checker
Add allow bypass colorspace checker for document type files
Updated Mediavorus version
This commit is contained in:
Sandeep
2018-02-22 15:31:20 +04:00
parent 5751213e3e
commit 9db8aff7b8
2 changed files with 18 additions and 11 deletions

22
composer.lock generated
View File

@@ -275,16 +275,16 @@
},
{
"name": "alchemy/mediavorus",
"version": "0.4.5",
"version": "0.4.6",
"source": {
"type": "git",
"url": "https://github.com/alchemy-fr/MediaVorus.git",
"reference": "ee7d1279a024130fc82fde9eabad86a667ed3630"
"reference": "1c5c1b20832237ff605a625cc90940c3a75a58c8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/MediaVorus/zipball/ee7d1279a024130fc82fde9eabad86a667ed3630",
"reference": "ee7d1279a024130fc82fde9eabad86a667ed3630",
"url": "https://api.github.com/repos/alchemy-fr/MediaVorus/zipball/1c5c1b20832237ff605a625cc90940c3a75a58c8",
"reference": "1c5c1b20832237ff605a625cc90940c3a75a58c8",
"shasum": ""
},
"require": {
@@ -334,7 +334,7 @@
"keywords": [
"metadata"
],
"time": "2016-05-02T15:08:36+00:00"
"time": "2018-02-20T17:48:47+00:00"
},
{
"name": "alchemy/oauth2php",
@@ -708,7 +708,7 @@
"parallel",
"process"
],
"time": "2016-11-30T13:34:30+00:00"
"time": "2016-11-30 13:34:30"
},
{
"name": "alchemy/worker-bundle",
@@ -1365,7 +1365,7 @@
"cache",
"caching"
],
"time": "2016-10-29T11:16:17+00:00"
"time": "2016-10-29 11:16:17"
},
{
"name": "doctrine/collections",
@@ -3631,7 +3631,7 @@
"support": {
"source": "https://github.com/alchemy-fr/Imagine/tree/alchemy-0.6.2"
},
"time": "2015-01-13T18:12:26+00:00"
"time": "2015-01-13 18:12:26"
},
{
"name": "ircmaxell/password-compat",
@@ -4006,7 +4006,7 @@
"support": {
"source": "https://github.com/alchemy-fr/JMSTranslationBundle/tree/rebase-2015-10-20"
},
"time": "2015-11-04T15:09:44+00:00"
"time": "2015-11-04 15:09:44"
},
{
"name": "justinrainbow/json-schema",
@@ -4263,7 +4263,7 @@
"league",
"rest"
],
"time": "2016-12-02T14:55:48+00:00"
"time": "2016-12-02 14:55:48"
},
{
"name": "media-alchemyst/media-alchemyst",
@@ -4494,7 +4494,7 @@
"homepage": "http://www.lickmychip.com/"
}
],
"time": "2014-02-13T20:27:33+00:00"
"time": "2014-02-13 20:27:33"
},
{
"name": "neutron/recaptcha",

View File

@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Border\Checker;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Doctrine\ORM\EntityManager;
use MediaVorus\Media\Document;
use Symfony\Component\Translation\TranslatorInterface;
class Colorspace extends AbstractChecker
@@ -23,6 +24,7 @@ class Colorspace extends AbstractChecker
const COLORSPACE_RGB = 'rgb';
const COLORSPACE_CMYK = 'cmyk';
const COLORSPACE_GRAYSCALE = 'grayscale';
const COLORSPACE_RGBA = 'rgba';
public function __construct(Application $app, array $options)
{
@@ -40,6 +42,8 @@ class Colorspace extends AbstractChecker
if (0 === count($this->colorspaces)) {
$boolean = true; //bypass color if empty array
} elseif ($file->getMedia()->getType() === Document::TYPE_DOCUMENT) {
$boolean = true; //bypass color checker if file is of type document
} elseif (method_exists($file->getMedia(), 'getColorSpace')) {
$colorspace = null;
switch ($file->getMedia()->getColorSpace())
@@ -54,6 +58,9 @@ class Colorspace extends AbstractChecker
case \MediaVorus\Media\Image::COLORSPACE_GRAYSCALE:
$colorspace = self::COLORSPACE_GRAYSCALE;
break;
case \MediaVorus\Media\Image::COLORSPACE_RGBA:
$colorspace = self::COLORSPACE_RGBA;
break;
}
$boolean = $colorspace !== null && in_array(strtolower($colorspace), $this->colorspaces);