From 6abfe21090efc94d13fa43fd2873db03e3aafc4d Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:39:39 +0300 Subject: [PATCH] takken acount dpi setting when writemeta (#4461) --- .../WorkerManager/Worker/WriteMetadatasWorker.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/WorkerManager/Worker/WriteMetadatasWorker.php b/lib/Alchemy/Phrasea/WorkerManager/Worker/WriteMetadatasWorker.php index 7e0a9ed33a..6074d7d28a 100644 --- a/lib/Alchemy/Phrasea/WorkerManager/Worker/WriteMetadatasWorker.php +++ b/lib/Alchemy/Phrasea/WorkerManager/Worker/WriteMetadatasWorker.php @@ -6,6 +6,7 @@ use Alchemy\Phrasea\Application\Helper\DispatcherAware; use Alchemy\Phrasea\Application\Helper\EntityManagerAware; use Alchemy\Phrasea\Core\PhraseaTokens; +use Alchemy\Phrasea\Media\Subdef\Subdef; use Alchemy\Phrasea\Metadata\TagFactory; use Alchemy\Phrasea\Model\Repositories\WorkerRunningJobRepository; use Alchemy\Phrasea\WorkerManager\Event\SubdefinitionWritemetaEvent; @@ -252,9 +253,21 @@ public function process(array $payload) $this->writer->erase($subdef->get_name() != 'document' || $clearDoc, true); + $resolutionXY = []; + + if ($subdef->get_name() != 'document') { + $subdefType = $subdef->getDataboxSubdef()->getSubdefType(); + + // get the resolution DPI option from the admin configuration if the media type has one + if (in_array($subdefType->getType(), [Subdef::TYPE_IMAGE, Subdef::TYPE_ANIMATION, Subdef::TYPE_UNKNOWN])) { + $resolution = $subdefType->getOption('resolution')->getValue(); + $resolutionXY = [$resolution, $resolution]; + } + } + // write meta in file try { - $this->writer->write($subdef->getRealPath(), $metadata); + $this->writer->write($subdef->getRealPath(), $metadata, null, $resolutionXY); $this->messagePublisher->pushLog(sprintf('metadatas written %s databoxname=%s databoxid=%d recordid=%d', $subdef->get_name(), $databox->get_viewname(), $databox->get_sbas_id(), $recordId), 'info');