Skip to content

Commit

Permalink
Add metadata to file parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Müller <[email protected]>
  • Loading branch information
SystemKeeper committed Dec 3, 2023
1 parent 18eb8ba commit 3dbc2d7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/Chat/Parser/SystemMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\FilesMetadata\Exceptions\FilesMetadataNotFoundException;
use OCP\FilesMetadata\IFilesMetadataManager;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IL10N;
Expand Down Expand Up @@ -85,6 +87,7 @@ public function __construct(
protected IRootFolder $rootFolder,
protected ICloudIdManager $cloudIdManager,
protected IURLGenerator $url,
protected IFilesMetadataManager $metadataManager,
) {
}

Expand Down Expand Up @@ -732,6 +735,21 @@ protected function getFileFromShare(?Participant $participant, string $shareId):
'preview-available' => $this->previewManager->isAvailable($node) ? 'yes' : 'no',
];

// If a preview is available, check if we can get the dimension of the
if ($data['preview-available']) {
try {
$metadata = $this->metadataManager->getMetaData($node->getId(), false);

if ($metadata->hasKey('photos-size')) {
$sizeMetadata = $metadata->getArray('photos-size');

$data['width'] = $sizeMetadata['width'];
$data['height'] = $sizeMetadata['height'];
}
} catch (FilesMetadataNotFoundException $e) {
}
}

if ($node->getMimeType() === 'text/vcard') {
$vCard = $node->getContent();

Expand Down

0 comments on commit 3dbc2d7

Please sign in to comment.