From 9db8aff7b84ef873d01f6aa5ea867cea8afa65ff Mon Sep 17 00:00:00 2001 From: Sandeep Date: Thu, 22 Feb 2018 15:31:20 +0400 Subject: [PATCH] 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 --- composer.lock | 22 +++++++++---------- .../Phrasea/Border/Checker/Colorspace.php | 7 ++++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index cdad0d3708..62c2fca497 100644 --- a/composer.lock +++ b/composer.lock @@ -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", diff --git a/lib/Alchemy/Phrasea/Border/Checker/Colorspace.php b/lib/Alchemy/Phrasea/Border/Checker/Colorspace.php index e431f0cb61..a54481be60 100644 --- a/lib/Alchemy/Phrasea/Border/Checker/Colorspace.php +++ b/lib/Alchemy/Phrasea/Border/Checker/Colorspace.php @@ -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);