shiny doesn't load the image

3,947 views
Skip to first unread message

Inzirio

unread,
Nov 24, 2015, 6:18:30 AM11/24/15
to Shiny - Web Framework for R
Hi all,

i'm trying to load an image in my navbarPage as title, but when I load it, the html seems not find it...

I'm following this stackoverflow thread present, in order to add the image and the title to the navbarPage.

I added the images in the www folder where my shinyapp is stored, but i load it using the command shinyApp(myUI, myServer)

Here i report an example code:

    
myUI <- fluidPage(
  list(tags$head(HTML('<link rel="icon", href="iho.png", 
                                   type="image/png" />'))),
  div(style="padding: 1px 0px; width: '100%'",
      titlePanel(
        title="", windowTitle="mytitle"
      )
  ),
  
  navbarPage(title = div(img(src="int.png", height = 22, width = 100),"mytitle"),
                      tabPanel( #...
                               )
                     

  )
)


myServer <- function(input, output, session) {
##
  }

shinyApp(myUI, myServer)

Where i'm wrong? 

Thank you all,
inzirio

Inzirio

unread,
Nov 24, 2015, 9:58:04 AM11/24/15
to Shiny - Web Framework for R
solved!

Organising the code in two separated files, ui.R and server.R and using the classical runApp function, the images start to be visualized!

inzirio

Joe Cheng

unread,
Nov 24, 2015, 5:29:12 PM11/24/15
to Inzirio, Shiny - Web Framework for R
You could do the same thing with a single app.R file, but you still need to call runApp(); simply printing the shinyApp() object will launch the app but Shiny won't know about the www directory. It's a bit unintuitive, sorry.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/3b19251f-42e5-47cf-979d-550da132d406%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Inzirio

unread,
Nov 25, 2015, 6:13:35 AM11/25/15
to Shiny - Web Framework for R, mioap...@gmail.com
No problem,

I suppose it's one of the "superpower" that you lost using the shinyApp instead of runApp, as described in the Detail section of this article. ^^

Thanks for your reply!

inzirio
Reply all
Reply to author
Forward
0 new messages