From e22e0d4f45f0146f6eb8bc04bd016acd3b2568e4 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 25 Jan 2024 16:18:38 +0100 Subject: [PATCH] fix(Classifier): Use IConfig Signed-off-by: Marcel Klehr --- lib/Classifiers/Classifier.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Classifiers/Classifier.php b/lib/Classifiers/Classifier.php index de57b199..5e1bdd13 100644 --- a/lib/Classifiers/Classifier.php +++ b/lib/Classifiers/Classifier.php @@ -20,6 +20,7 @@ use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; +use OCP\IConfig; use OCP\IPreview; use OCP\ITempManager; use Psr\Log\LoggerInterface; @@ -339,7 +340,7 @@ public function generatePreviewWithProvider(File $file): string { if (in_array($imagetype, [IMAGETYPE_WEBP, IMAGETYPE_AVIF, false])) { // To troubleshoot if it is a webp or avif. $previewImage = imagecreatefromstring(file_get_contents($tmpname)); - $use_gd_quality = (int)$this->config->getSystemValue('recognize.preview.quality', '100'); + $use_gd_quality = (int)\OCP\Server::get(IConfig::class)->getSystemValue('recognize.preview.quality', '100'); if (imagejpeg($previewImage, $tmpname, $use_gd_quality) === false) { imagedestroy($previewImage); throw new \OCA\Recognize\Exception\Exception('Could not copy preview file to temp folder'); @@ -380,7 +381,7 @@ public function generatePreviewWithGD(string $path): string { // Create a temporary file *with the correct extension* $tmpname = $this->tempManager->getTemporaryFile('.jpg'); - $use_gd_quality = (int)$this->config->getSystemValue('recognize.preview.quality', '100'); + $use_gd_quality = (int)\OCP\Server::get(IConfig::class)->getSystemValue('recognize.preview.quality', '100'); if (imagejpeg($previewImage, $tmpname, $use_gd_quality) === false) { imagedestroy($image); imagedestroy($previewImage);