Placing image in Shiny titlePanel

I'd like to place an image in my titlePanel . After reading through this SO post, I put my image in a www folder and wrote this:

library(shiny)

ui <- fluidPage(
  
  titlePanel(title=div(img(src="nhl.jpg")))
)

server <- function(input, output, session){
  
}

shinyApp(ui, server)

I'm not sure what I did wrong, since it looks like a pretty simple task, but I get a Question Mark icon instead of the NHL logo

1 Like

Hi Jason, your shiny example (R-code) should work. It's maybe just a source problem of your image directory. Is your *.R script-file saved in the right directory? E.g.

So, back to your example:

library(shiny)

ui <- fluidPage(
  
  titlePanel(title=div(img(src="nhl.jpg")))
  
  # titlePanel(title=tags$a(href='http://www.nhl.com/',
  #                         tags$img(src='nhl.jpg',height='50',width='50')))
)

server <- function(input, output, session){
  
}

shinyApp(ui, server)
2 Likes

Hey Adam,

I figured out my problem: The image doesn't render when I run the code from my R script. However, when I press Run App , it shows up. Hope this helps others.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.