From 1bef595785bec2ef9660f8301910cd8a9c2e334a Mon Sep 17 00:00:00 2001 From: jygaulier Date: Tue, 19 Sep 2023 18:25:25 +0200 Subject: [PATCH] add background color to subdefs of transparent tiff. (#4376) bump media-alchemyst and imagine --- composer.json | 4 +-- composer.lock | 30 +++++++++++----------- lib/Alchemy/Phrasea/Media/Subdef/Image.php | 3 +++ lib/classes/databox/subdef.php | 3 +++ 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 5b96873016..08eef8c780 100644 --- a/composer.json +++ b/composer.json @@ -89,14 +89,14 @@ "hoa/dispatcher": "~0.0", "hoa/router": "~2.0", "igorw/get-in": "~1.0", - "imagine/imagine": "0.9.0", + "imagine/imagine": "^0.10.0", "jms/serializer": "~0.10", "jms/translation-bundle": "dev-fix-2021-04-19", "justinrainbow/json-schema": "2.0.3 as 1.6.1", "league/flysystem": "^1.0", "league/flysystem-aws-s3-v2": "^1.0", "league/fractal": "dev-webgalleries#af1acc0275438571bc8c1d08a05a4b5af92c9f97 as 0.13.0", - "media-alchemyst/media-alchemyst": "^0.5.7", + "media-alchemyst/media-alchemyst": "^4.1.8", "monolog/monolog": "~1.3", "mrclay/minify": "~2.1.6", "neutron/process-manager": "2.0.x-dev@dev", diff --git a/composer.lock b/composer.lock index 0a03c50c83..039f1fcf64 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "eadceda3244b4c8a1890620dbbdd655b", + "content-hash": "12f2708ee329327ead6eac100cdf302e", "packages": [ { "name": "alchemy-fr/tcpdf-clone", @@ -3706,16 +3706,16 @@ }, { "name": "imagine/imagine", - "version": "v0.9.0", + "version": "v0.10.0", "source": { "type": "git", "url": "https://github.com/alchemy-fr/Imagine.git", - "reference": "94dc35d33d5730d5ad2031c3b17fc9761a29d322" + "reference": "352a4bbf72c34f9a4b8990da790d65d82ff9542a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/Imagine/zipball/94dc35d33d5730d5ad2031c3b17fc9761a29d322", - "reference": "94dc35d33d5730d5ad2031c3b17fc9761a29d322", + "url": "https://api.github.com/repos/alchemy-fr/Imagine/zipball/352a4bbf72c34f9a4b8990da790d65d82ff9542a", + "reference": "352a4bbf72c34f9a4b8990da790d65d82ff9542a", "shasum": "" }, "require": { @@ -3759,9 +3759,9 @@ "image processing" ], "support": { - "source": "https://github.com/alchemy-fr/Imagine/tree/v0.9.0" + "source": "https://github.com/alchemy-fr/Imagine/tree/v0.10.0" }, - "time": "2022-12-01T14:36:05+00:00" + "time": "2023-09-14T14:43:24+00:00" }, { "name": "ircmaxell/password-compat", @@ -4343,22 +4343,22 @@ }, { "name": "media-alchemyst/media-alchemyst", - "version": "0.5.7", + "version": "v4.1.8", "source": { "type": "git", "url": "https://github.com/alchemy-fr/Media-Alchemyst.git", - "reference": "5c7277ccdab03dd34dea13bec4ac1f4e5963ac94" + "reference": "9097b7b074afc28aa4d5a83e7a2e59609c59b617" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/Media-Alchemyst/zipball/5c7277ccdab03dd34dea13bec4ac1f4e5963ac94", - "reference": "5c7277ccdab03dd34dea13bec4ac1f4e5963ac94", + "url": "https://api.github.com/repos/alchemy-fr/Media-Alchemyst/zipball/9097b7b074afc28aa4d5a83e7a2e59609c59b617", + "reference": "9097b7b074afc28aa4d5a83e7a2e59609c59b617", "shasum": "" }, "require": { "alchemy/ghostscript": "~0.4.0", "alchemy/mediavorus": "^0.4.4", - "imagine/imagine": "^0.9.0", + "imagine/imagine": "^0.10.0", "monolog/monolog": "~1.0", "neutron/temporary-filesystem": "^2.1.1", "php": ">=5.3.3", @@ -4415,9 +4415,9 @@ ], "support": { "issues": "https://github.com/alchemy-fr/Media-Alchemyst/issues", - "source": "https://github.com/alchemy-fr/Media-Alchemyst/tree/0.5.7" + "source": "https://github.com/alchemy-fr/Media-Alchemyst/tree/v4.1.8" }, - "time": "2023-08-07T12:59:05+00:00" + "time": "2023-09-14T15:36:28+00:00" }, { "name": "monolog/monolog", @@ -8736,5 +8736,5 @@ "ext-intl": "*" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Image.php b/lib/Alchemy/Phrasea/Media/Subdef/Image.php index 92d49f60a0..46d5903417 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/Image.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/Image.php @@ -25,6 +25,7 @@ class Image extends Provider const OPTION_WATERMARK = 'watermark'; const OPTION_WATERMARKTEXT = 'watermarktext'; const OPTION_WATERMARKRID = 'watermarkrid'; + const OPTION_BACKGROUNDCOLOR = 'backgroundcolor'; protected $options = []; @@ -41,6 +42,7 @@ public function __construct(TranslatorInterface $translator) $this->registerOption(new OptionType\EnumButton($this->translator->trans('Watermark'), self::OPTION_WATERMARK, array('no' => 'no', 'yes' => 'yes'), 'no')); $this->registerOption(new OptionType\Text($this->translator->trans('Watermark text'), self::OPTION_WATERMARKTEXT, '')); $this->registerOption(new OptionType\Text($this->translator->trans('Watermark Record_id'), self::OPTION_WATERMARKRID, '')); + $this->registerOption(new OptionType\Text($this->translator->trans('Background Color'), self::OPTION_BACKGROUNDCOLOR, '')); } public function getType() @@ -69,6 +71,7 @@ public function getMediaAlchemystSpec() $this->spec->setStrip($this->getOption(self::OPTION_STRIP)->getValue()); $this->spec->setFlatten($this->getOption(self::OPTION_FLATTEN)->getValue()); $this->spec->setResolution($resolution, $resolution); + $this->spec->setBackgroundColor($this->getOption(self::OPTION_BACKGROUNDCOLOR)->getValue()); return $this->spec; } diff --git a/lib/classes/databox/subdef.php b/lib/classes/databox/subdef.php index 6909a84d52..9ae75c6878 100644 --- a/lib/classes/databox/subdef.php +++ b/lib/classes/databox/subdef.php @@ -159,6 +159,9 @@ protected function buildImageSubdef(SimpleXMLElement $sd) if ($sd->watermarkrid) { $image->setOptionValue(Image::OPTION_WATERMARKRID, $sd->watermarkrid); } + if ($sd->backgroundcolor) { + $image->setOptionValue(Image::OPTION_BACKGROUNDCOLOR, $sd->backgroundcolor); + } return $image; } /**