mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
add : allow to set multiple --source, the first not-empty meta is copied to destination (#4516)
This commit is contained in:
@@ -1287,12 +1287,15 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
* @return array|null
|
||||
* @throws \PHPExiftool\Exception\EmptyCollectionException
|
||||
*/
|
||||
public function getFileMetadataByTag($tag)
|
||||
public function getFileMetadataByTag($tags)
|
||||
{
|
||||
$logger = new Logger('exif-tool');
|
||||
$reader = Reader::create($logger);
|
||||
|
||||
$value = null;
|
||||
if(!is_array($tags)) {
|
||||
$tags = [$tags];
|
||||
}
|
||||
$tags = array_fill_keys($tags, null);
|
||||
|
||||
// throw exception
|
||||
$documentSubdef = $this->get_subdef('document');
|
||||
@@ -1301,13 +1304,21 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
|
||||
/** @var Metadata $metadata */
|
||||
foreach ($metadatas as $metadata) {
|
||||
if ($metadata->getTag() == $tag) {
|
||||
$value = explode(";", $metadata->getValue());
|
||||
/** @var string $t */
|
||||
$t = (string)$metadata->getTag();
|
||||
if (array_key_exists($t, $tags)) {
|
||||
$tags[$t] = explode(";", $metadata->getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
foreach($tags as $tag => $value) {
|
||||
if($value !== null) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user