diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-06-15 18:02:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-15 18:02:14 +0300 |
commit | 8f6acbff621b02cead64219eb9e6b03f4951075a (patch) | |
tree | 68dec6474e476078801be1cd2de3036401c3fc8b /apps/theming/lib/Controller | |
parent | d82ef721611654aa3a3aab0ea3c8c85c7e0187d6 (diff) | |
parent | ceee91d9d455eed8b01942bc56767c69077e9f3f (diff) |
Merge pull request #9258 from nextcloud/theming-logo-png
Convert theming app logo to PNG to show it properly in emails
Diffstat (limited to 'apps/theming/lib/Controller')
-rw-r--r-- | apps/theming/lib/Controller/IconController.php | 4 | ||||
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 14 |
2 files changed, 13 insertions, 5 deletions
diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php index 0caf9a2bc37..a2727546e09 100644 --- a/apps/theming/lib/Controller/IconController.php +++ b/apps/theming/lib/Controller/IconController.php @@ -119,7 +119,7 @@ class IconController extends Controller { $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); } catch (NotFoundException $e) { } - if ($iconFile === null && $this->themingDefaults->shouldReplaceIcons()) { + if ($iconFile === null && $this->imageManager->shouldReplaceIcons()) { try { $iconFile = $this->imageManager->getCachedImage('favIcon-' . $app); } catch (NotFoundException $exception) { @@ -155,7 +155,7 @@ class IconController extends Controller { $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); } catch (NotFoundException $e) { } - if ($this->themingDefaults->shouldReplaceIcons()) { + if ($this->imageManager->shouldReplaceIcons()) { try { $iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app); } catch (NotFoundException $exception) { diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index 99b98ab7da3..96f8dfde9fd 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -262,6 +262,8 @@ class ThemingController extends Controller { $folder = $this->appData->newFolder('images'); } + $this->imageManager->delete($key); + $target = $folder->newFile($key); $supportedFormats = ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/svg']; $detectedMimeType = mime_content_type($image['tmp_name']); @@ -351,12 +353,13 @@ class ThemingController extends Controller { * @NoCSRFRequired * * @param string $key + * @param bool $useSvg * @return FileDisplayResponse|NotFoundResponse - * @throws \Exception + * @throws NotPermittedException */ - public function getImage(string $key) { + public function getImage(string $key, bool $useSvg = true) { try { - $file = $this->imageManager->getImage($key); + $file = $this->imageManager->getImage($key, $useSvg); } catch (NotFoundException $e) { return new NotFoundResponse(); } @@ -365,6 +368,11 @@ class ThemingController extends Controller { $response->cacheFor(3600); $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key . 'Mime', '')); $response->addHeader('Content-Disposition', 'attachment; filename="' . $key . '"'); + if (!$useSvg) { + $response->addHeader('Content-Type', 'image/png'); + } else { + $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key . 'Mime', '')); + } return $response; } |