Skip to content

Commit

Permalink
takken acount dpi setting when writemeta (#4461)
Browse files Browse the repository at this point in the history
  • Loading branch information
aynsix authored Jan 26, 2024
1 parent 71ef4bf commit 6abfe21
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 6abfe21

Please sign in to comment.