【问题标题】:r Shiny: renderImage from wwwr Shiny:来自 www 的渲染图像
【发布时间】:2016-04-13 13:47:59
【问题描述】:

renderImage 在尝试从 Internet 渲染图像时不起作用。当图像在本地机器上时,它可以工作。

  output$myImage <- renderImage({
    pfad <- "https://www.rstudio.com/wp-content/uploads/2014/03/blue-125.png"
    list(src = pfad,
         contentType = 'image/png',
         width = 400,
         height = 300,
         alt = "This is alternate text")
  }, deleteFile = F)


imageOutput("myImage")

【问题讨论】:

标签: r shiny


【解决方案1】:

您可以直接在 ui 或响应式上下文中使用 tags$img

library("shiny")
ui <- fluidPage(
  fluidRow(
    column(
      6,
      tags$img(src = "https://www.rstudio.com/wp-content/uploads/2014/03/blue-125.png")
    ),
    column(
      6,
      uiOutput(outputId = "image")
    )
  )
)
server <- function(input, output) {
  output$image <- renderUI({
    tags$img(src = "https://www.rstudio.com/wp-content/uploads/2014/03/blue-125.png")
  })
}
shinyApp(ui = ui, server = server)

【讨论】:

    猜你喜欢
    • 2020-06-19
    • 2020-11-08
    • 1970-01-01
    • 2016-07-01
    • 2021-03-20
    • 2020-04-04
    • 1970-01-01
    • 1970-01-01
    • 2022-11-15
    相关资源
    最近更新 更多