2
votes

I want my logo (a png file) to be shown at the top left of the shiny dashboard. So I have kept the png file here:

$$:/srv/shiny-server/www$ ll

total 24
drwxr-xr-x 2 root root  4096 Jul  7 00:49 ./
drwxrwxrwx 3 root root  4096 Jul  7 00:48 ../
-rw-rw-r-- 1 root root 14390 Jul  6 23:38 logo.png

because my /etc/shiny-server/shiny-server.conf file has:

# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server;

In my MyApp/ui.R code, I have:

shinyUI(

  dashboardPage(
    dashboardHeader(
      title = tags$a(href='http://www.tech.com', tags$img(src="logo.png")),
 ...
)

The app's name is MyApp and it has server.R and ui.R.

When I run this, I get an icon of a question mark which I assume means that it could not find the file. What I cant get is where exactly is shiny server looking for this file? Where am I supposed to put it so that it can read the file?

I have put read permissions to the logo.png file and have tried putting it in all sorts of places (within /src/shiny-server and also within MyApp, inside or not inside of a www folder but all to no avail). I am obviously missing the actual correct location set by convention. The problem is that RStudio does not give any error message at the console that could have read something like "Could not find file ... when looking at location ....".

I tried the documentation but couldnt get clearly with a clear example of where exactly to put this png file to make it work.

I am using shiny-server version 1.4.2

> system('shiny-server --version', intern = TRUE)
[1] "Shiny Server v1.4.2.786" "Node.js v0.10.40"       
> packageVersion("shiny")
[1] ‘0.13.2’

I will appreciate any help in the matter. Thanks very much in advance.

1

1 Answers

1
votes

Okay, I discovered the error. It was probably too late at night and I had a brain freeze. For this to work, the image should be in a folder www as in www/logo.png and this www directory should be placed in the same directory containing the files server.R and ui.R. Also, the permissions of the www folder should be drwxdrwxr_x and permissions of the logo.png file inside it, rwxrwxr__

It is actually as simple as that.