mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
PHRAS-2069 rescan file metadata command (#4420)
This commit is contained in:
@@ -45,6 +45,9 @@ use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use MediaVorus\MediaVorus;
|
||||
use Monolog\Logger;
|
||||
use PHPExiftool\Driver\Metadata\Metadata;
|
||||
use PHPExiftool\Reader;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
|
||||
@@ -1266,6 +1269,34 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $tag
|
||||
* @return array|null
|
||||
* @throws \PHPExiftool\Exception\EmptyCollectionException
|
||||
*/
|
||||
public function getFileMetadataByTag($tag)
|
||||
{
|
||||
$logger = new Logger('exif-tool');
|
||||
$reader = Reader::create($logger);
|
||||
|
||||
$value = null;
|
||||
|
||||
// throw exception
|
||||
$documentSubdef = $this->get_subdef('document');
|
||||
|
||||
$metadatas = $reader->files($documentSubdef->getRealPath())->first();
|
||||
|
||||
/** @var Metadata $metadata */
|
||||
foreach ($metadatas as $metadata) {
|
||||
if ($metadata->getTag() == $tag) {
|
||||
$value = explode(";", $metadata->getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
|
Reference in New Issue
Block a user