Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-05-08 14:06:31 +0300
committerJulius Härtl <jus@bitgrid.net>2018-06-05 17:47:38 +0300
commitd132527aa9c4baad344b11adef3a6f4a46cde3ab (patch)
tree701700d4dae0dd2c8b7a7ef7637f9f05e81fa49f /apps/theming/lib
parent9b919245f67f5511d6be7910f61d639b290eab26 (diff)
Use svg opt out as parameter
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/Controller/ThemingController.php9
-rw-r--r--apps/theming/lib/ImageManager.php14
2 files changed, 13 insertions, 10 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index f3a7f8cfcc5..7f2130ecbb8 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -358,12 +358,13 @@ class ThemingController extends Controller {
* @NoCSRFRequired
*
* @param string $key
+ * @param bool $useSvg
* @return FileDisplayResponse|NotFoundResponse
- * @throws \Exception
+ * @throws NotPermittedException
*/
- public function getImage(string $key, bool $asPng = false) {
+ public function getImage(string $key, bool $useSvg = true) {
try {
- $file = $this->imageManager->getImage($key, $asPng);
+ $file = $this->imageManager->getImage($key, $useSvg);
} catch (NotFoundException $e) {
return new NotFoundResponse();
}
@@ -372,7 +373,7 @@ 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 ($asPng) {
+ if (!$useSvg) {
$response->addHeader('Content-Type', 'image/png');
} else {
$response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key . 'Mime', ''));
diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php
index 850cd3e69bd..77afbbe8a87 100644
--- a/apps/theming/lib/ImageManager.php
+++ b/apps/theming/lib/ImageManager.php
@@ -65,10 +65,10 @@ class ImageManager {
$this->cacheFactory = $cacheFactory;
}
- public function getImageUrl(string $key): string {
+ public function getImageUrl(string $key, bool $useSvg = true): string {
$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');
try {
- $this->getImage($key);
+ $image = $this->getImage($key, $useSvg);
return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => $key ]) . '?v=' . $cacheBusterCounter;
} catch (NotFoundException $e) {
}
@@ -83,16 +83,18 @@ class ImageManager {
}
}
- public function getImageUrlAbsolute(string $key): string {
- return $this->urlGenerator->getAbsoluteURL($this->getImageUrl($key));
+ public function getImageUrlAbsolute(string $key, bool $useSvg = true): string {
+ return $this->urlGenerator->getAbsoluteURL($this->getImageUrl($key, $useSvg));
}
/**
- * @param $key
+ * @param string $key
+ * @param bool $useSvg
* @return ISimpleFile
* @throws NotFoundException
+ * @throws NotPermittedException
*/
- public function getImage(string $key, bool $useSvg = false): ISimpleFile {
+ public function getImage(string $key, bool $useSvg = true): ISimpleFile {
$logo = $this->config->getAppValue('theming', $key . 'Mime', false);
$folder = $this->appData->getFolder('images');
if ($logo === false || !$folder->fileExists($key)) {