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

Version 36 (user 42, 2017-06-20 11:02) → Version 37/39 (Toshi MARUYAMA, 2017-06-20 16:23)

h1. HowTo add a logo to your Redmine banner

You can very easily add a logo to your Redmine banner by modifying your base.html.erb file.
Big thanks to "Chris Miller":/users/758 for showing me how to accomplish this :)

Note: This has been tested using the Squeejee Theme and the Classic Theme.
Note2: if you used apache2 passenger module to install redmine,the location of redmine should be @/usr/share/redmine@ instead of @/opt/redmine@

h2. Edit your @base.html.erb@ file

Example: Example:<pre>
<pre>
#
nano /opt/redmine/app/views/layouts/base.html.erb
</pre>
/opt/redmine/app/views/layouts/base.html.erb&lt;/pre&gt;

Find this line:
<pre><code class="erb">
line:&lt;pre&gt;
<h1><%= page_header_title %></h1>
</code></pre>
%&gt;&lt;/h1&gt;&lt;/pre&gt;

Add this line directly above:
<pre><code class="erb">
above:&lt;pre&gt;
<img src="<%= Redmine::Utils.relative_url_root %>/images/logo.png" style="top-margin: 15px; left-margin: 15px;"/></code></pre> 15px;&quot;/&gt;&lt;/pre&gt;

The ruby statement @<%= Redmine::Utils.relative_url_root %>@ will produce the relative URI for your redmine installation.

Now it should look like this:
<pre><code class="erb">
this:&lt;pre&gt;
</div>

<img src="<%= Redmine::Utils.relative_url_root %>/images/logo.png" style="top-margin: 15px; left-margin: 15px;"/>
<h1><%= page_header_title %></h1>

<% if display_main_menu?(@project) %>
</code></pre>
%&gt;&lt;/pre&gt;

h2. Upload your logo

Example using the scp command: command:&lt;pre&gt;
<pre>
#
scp logo.png root@example.com:/opt/redmine/public/images
</pre>
root@example.com:/opt/redmine/public/images&lt;/pre&gt;

You probably should chown the uploaded logo: logo:&lt;pre&gt;
<pre>
#
chown redmine:redmine /opt/redmine/public/images/logo.png
</pre>
/opt/redmine/public/images/logo.png&lt;/pre&gt;

h2. Restart your web server

Examples:
<pre>
# /etc/init.d/apache2 restart
# /etc/init.d/httpd restart
# /etc/init.d/nginx restart
</pre>
Examples:&lt;pre&gt;/etc/init.d/apache2 restart&lt;/pre&gt;&lt;pre&gt;/etc/init.d/httpd restart&lt;/pre&gt;&lt;pre&gt;/etc/init.d/nginx restart&lt;/pre&gt;