Skip to content

Commit

Permalink
fix(Classifier): Use IConfig
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Jan 25, 2024
1 parent 83c1828 commit e22e0d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Classifiers/Classifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e22e0d4

Please sign in to comment.