shinylive-r with renderImage()

,

Aha I see. Then you can put the tags$img inside a renderUI like this:

#| standalone: true
#| viewerHeight: 300

library(shiny)
library(bslib)

ui <- page_fluid(
  selectInput("select", "Select image", 
              choices = c(
                "Quarto" = "https://quarto-dev.github.io/quarto-r/logo.png", 
               "Shiny" = "https://raw.githubusercontent.com/rstudio/shiny/main/man/figures/logo.png"
              )),
  uiOutput("image")
)

server <- function(input, output) {
  output$image <- renderUI({
    tags$img(src = input$select, width = "200px")
  })
}

shinyApp(ui = ui, server = server)

1 Like