capabilities = $capabilities->getCapabilities()['richdocuments'] ?? []; } public function isAvailable(FileInfo $file): bool { if (isset($this->capabilities['collabora']['convert-to']['available'])) { return (bool)$this->capabilities['collabora']['convert-to']['available'] && $this->appConfig->isPreviewGenerationEnabled(); } return false; } public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { if ($file->getSize() === 0) { return null; } try { $response = $this->remoteService->convertFileTo($file, 'png'); $image = new Image(); $image->loadFromData($response); if ($image->valid()) { $image->scaleDownToFit($maxX, $maxY); return $image; } } catch (\Exception $e) { $this->logger->info('Failed to convert preview: ' . $e->getMessage(), ['exception' => $e]); return null; } return null; } }