0

I have the following code below but my logo is not showing up. I have the PNG saved in a www folder but as you can see in the image, it is not showing. Any help would be greatly appreciated.

ui <- 
  dashboardPage(
  dashboardHeader(
    title = img(src='logo.png', align = "right", height = 100, width = 200),
    titleWidth = 300
  ),

enter image description here

MrFlick
  • 195,160
  • 17
  • 277
  • 295
caves23
  • 1
  • 1
  • Where is the `www` folder? How are you running the application? It's easier to help you if you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Jul 13 '22 at 21:07
  • Thanks, sorry new to this. Let me put together a better example. My www folder is saved in my working directory. I am running on the following: R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043) – caves23 Jul 13 '22 at 21:20
  • you might need to use the absolute file path. Ex `\Users\Project\www\logo.png` – Daniel_j_iii Jul 14 '22 at 00:04

1 Answers1

0

A way that always works for me it's to load an image from a public repository (i.e. the github repo from the project) into the header:

ui <- 
dashboardPage(
#here replace "raw.githubusercontent.com/munoztd0/xaringan/master/logo_plain.png" with whatever public image you want
 header = list(
    tags$script(HTML("var header = $('.navbar > .container-fluid');
header.append('<div style=\"float:right\"><ahref=\"URL\"><img
src=\"https://raw.githubusercontent.com/munoztd0/xaringan/master/logo_plain.png\" alt=\"alt\" style=\"float:right;width:100px;height:41px;padding-top:10px;\"> </a></div>');
console.log(header)")),
    tags$script(HTML("var header = $('.navbar > .container-fluid');
header.append('<div style=\"float:right;height:30px;padding-right:50px;\"><h5></h5></div>');"))
  )
#change the css to change the size, position, padding ,etc..