Howto add a logo to your Redmine banner » History » Version 36

user 42, 2017-06-20 11:02
<%= page_header_title %> is nessesary to show the title of every project

1 6 Mischa The Evil
h1. HowTo add a logo to your Redmine banner
2 6 Mischa The Evil
3 35 Mischa The Evil
You can very easily add a logo to your Redmine banner by modifying your base.html.erb file.
4 6 Mischa The Evil
Big thanks to "Chris Miller":/users/758 for showing me how to accomplish this :)
5 6 Mischa The Evil
6 6 Mischa The Evil
Note: This has been tested using the Squeejee Theme and the Classic Theme.
7 9 Vojtěch Horký
Note2: if you used apache2 passenger module to install redmine,the location of redmine should be @/usr/share/redmine@ instead of @/opt/redmine@
8 1 Aaron Johnson
9 35 Mischa The Evil
h2. Edit your @base.html.erb@ file
10 6 Mischa The Evil
11 6 Mischa The Evil
Example:<pre>
12 35 Mischa The Evil
nano /opt/redmine/app/views/layouts/base.html.erb</pre>
13 6 Mischa The Evil
14 6 Mischa The Evil
Find this line:<pre>
15 6 Mischa The Evil
    <h1><%= page_header_title %></h1></pre>
16 6 Mischa The Evil
17 36 user 42
Add this line directly above:<pre>
18 10 Peter Englmaier
     <img src="<%= Redmine::Utils.relative_url_root %>/images/logo.png" style="top-margin: 15px; left-margin: 15px;"/></pre>
19 1 Aaron Johnson
20 10 Peter Englmaier
The ruby statement @<%= Redmine::Utils.relative_url_root %>@ will produce the relative URI for your redmine installation.
21 10 Peter Englmaier
22 10 Peter Englmaier
23 1 Aaron Johnson
Now it should look like this:<pre>
24 6 Mischa The Evil
    </div>
25 1 Aaron Johnson
26 6 Mischa The Evil
     <img src="<%= Redmine::Utils.relative_url_root %>/images/logo.png" style="top-margin: 15px; left-margin: 15px;"/>
27 36 user 42
     <h1><%= page_header_title %></h1>
28 6 Mischa The Evil
29 6 Mischa The Evil
    <% if display_main_menu?(@project) %></pre>
30 6 Mischa The Evil
31 35 Mischa The Evil
h2. Upload your logo
32 6 Mischa The Evil
33 6 Mischa The Evil
Example using the scp command:<pre>
34 6 Mischa The Evil
scp logo.png root@example.com:/opt/redmine/public/images</pre>
35 6 Mischa The Evil
36 6 Mischa The Evil
You probably should chown the uploaded logo:<pre>
37 6 Mischa The Evil
chown redmine:redmine /opt/redmine/public/images/logo.png</pre>
38 6 Mischa The Evil
39 35 Mischa The Evil
h2. Restart your web server
40 6 Mischa The Evil
41 6 Mischa The Evil
Examples:<pre>/etc/init.d/apache2 restart</pre><pre>/etc/init.d/httpd restart</pre><pre>/etc/init.d/nginx restart</pre>