7

I have a static image in the local folder I am trying to render in the Shiny UI and it does not work. Shows a broken image with a question mark in the middle.

ui <- fluidPage(img(src = 'imagefile.png', height = '100px', width = '100px'))
server <- function(input, output) {}
shinyApp(ui = ui, server = server)

Any idea what is going on?

Gopala
  • 10,363
  • 7
  • 45
  • 77
  • in addition to @jenesaisquoi's answer below, save your App in the same directory you saved your www folder and name your app "app.R" – shiny Mar 03 '16 at 00:24

1 Answers1

14

Put the image in a folder called www in the same directory, so you have www/imagefile.png. Then, call

library(shiny)
ui <- fluidPage(img(src = 'imagefile.png', height = '100px', width = '100px'))
server <- function(input, output) {}
shinyAppDir(".")

But, you probably want to be using runApp with a separate ui and server file.

Rorschach
  • 31,301
  • 5
  • 78
  • 129