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?
It's just the image-display that is faulty. By default, RStudio searches in the 'www' folder. Try creating such a folder and place your image file in there. Make sure you still use the same path without 'www' for the src .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With