diff options
author | kesselb <mail@danielkesselberg.de> | 2020-11-04 12:30:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 12:30:24 +0100 |
commit | b65d9eb99da370155d060b90ed3b955dbc6c15ab (patch) | |
tree | 655cb4435b7abf906d6c5ca0e396261f1a324d6b | |
parent | 0e1c9af98da2f41140d2cba8a4638e6d8ccf2361 (diff) | |
parent | dd93532526f2de7f6c7ae1a2a7b76b0451be1844 (diff) | |
download | nextcloud-server-b65d9eb99da370155d060b90ed3b955dbc6c15ab.tar.gz nextcloud-server-b65d9eb99da370155d060b90ed3b955dbc6c15ab.zip |
Merge pull request #23890 from nextcloud/techdebt/noid/refactor-theming-getImage
Cleanup ImageManager::getImage()
-rw-r--r-- | apps/theming/lib/ImageManager.php | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php index 7f9b410ff9c..469480d1e10 100644 --- a/apps/theming/lib/ImageManager.php +++ b/apps/theming/lib/ImageManager.php @@ -101,7 +101,6 @@ class ImageManager { * @throws NotPermittedException */ public function getImage(string $key, bool $useSvg = true): ISimpleFile { - $pngFile = null; $logo = $this->config->getAppValue('theming', $key . 'Mime', false); $folder = $this->appData->getFolder('images'); if ($logo === false || !$folder->fileExists($key)) { @@ -116,17 +115,14 @@ class ImageManager { $finalIconFile->setImageFormat('png32'); $pngFile = $folder->newFile($key . '.png'); $pngFile->putContent($finalIconFile->getImageBlob()); + return $pngFile; } catch (\ImagickException $e) { $this->logger->info('The image was requested to be no SVG file, but converting it to PNG failed: ' . $e->getMessage()); - $pngFile = null; } } else { - $pngFile = $folder->getFile($key . '.png'); + return $folder->getFile($key . '.png'); } } - if ($pngFile !== null) { - return $pngFile; - } return $folder->getFile($key); } |