diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index be9e06ec677..c04de738f62 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -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; @@ -85,6 +87,7 @@ public function __construct( protected IRootFolder $rootFolder, protected ICloudIdManager $cloudIdManager, protected IURLGenerator $url, + protected IFilesMetadataManager $metadataManager, ) { } @@ -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();