Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm missing something here because the image doesn't display.

Thanks.

shinyServer(function(input, output) {
  src = "einstein.jpg"
  print(file.exists(src))
  out = '<img src="einstein.jpg" style=width:304px;height:228px;>'
  output$text3<-renderText(out)

  })

shinyUI(fluidPage(

  htmlOutput("text3")

))
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.9k views
Welcome To Ask or Share your Answers For Others

1 Answer

If you put your picture einstein.jpg in a img/ subfolder of your app, you can use addResourcePath to allow access to it:

library(shiny)
shinyApp(ui=fluidPage(htmlOutput("text3")),
         server=(function(input, output) {
           addResourcePath("foo", "img")  
           out = '<img src="/foo/einstein.jpg" style=width:304px;height:228px;>'
           output$text3<-renderText(out)
         }))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...