Skip to content

Commit

Permalink
support SVG logo in dokuwiki template
Browse files Browse the repository at this point in the history
Inspired by https://forum.dokuwiki.org/d/20964-logo-too-big this adds
SVG support for setting the logo in the dokuwiki template.

Note: This introduces a fixed height for the logo (64px), previously
users could decide their logo size by simply uploading it in the right
size. Users who want a larger sized logo will have to override the
height in a userstyle now
  • Loading branch information
splitbrain committed Apr 5, 2023
1 parent 5399538 commit 0f9b97d
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/tpl/dokuwiki/css/design.less
Expand Up @@ -35,6 +35,7 @@
img {
float: left;
margin-right: .5em;
height: 64px;
}

span {
Expand Down
84 changes: 84 additions & 0 deletions lib/tpl/dokuwiki/images/dokuwiki.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions lib/tpl/dokuwiki/tpl_header.php
Expand Up @@ -19,13 +19,18 @@

<h1 class="logo"><?php
// get logo either out of the template images folder or data/media folder
$logoSize = array();
$logo = tpl_getMediaFile(array(':wiki:logo.png', ':logo.png', 'images/logo.png'), false, $logoSize);
$logoSize = [];
$logo = tpl_getMediaFile([
':wiki:logo.svg', ':logo.svg',
':wiki:logo.png', ':logo.png',
'images/logo.svg', 'images/logo.png'
], false, $logoSize);

// display logo and wiki title in a link to the home page
tpl_link(
wl(),
'<img src="'.$logo.'" '.$logoSize[3].' alt="" /> <span>'.$conf['title'].'</span>',
'<img src="' . $logo . '" ' . ($logoSize ? $logoSize[3] : '') . ' alt="" />' .
'<span>' . $conf['title'] . '</span>',
'accesskey="h" title="' . tpl_getLang('home') . ' [h]"'
);
?></h1>
Expand Down

0 comments on commit 0f9b97d

Please sign in to comment.