我有一个Shiny应用程序,它返回一个字符串,其中包含指向Web上托管的图像的直接URL.我试图找到一种方法来直接显示此图像作为输出.
当使用带有src ="image url"的renderImage()时,应用程序不会显示图像.
以下是问题的示例:
ui.R
library(shiny)
shinyUI(fluidPage(
headerPanel("render externally hosted Image example"),
mainPanel(
# Use imageOutput to place the image on the page
imageOutput("myImage")
)
))
Run Code Online (Sandbox Code Playgroud)
server.R
library(shiny)
shinyServer(function(input, output, session) {
output$myImage <- renderImage({
list(src = "http://data-informed.com/wp-content/uploads/2013/11/R-language-logo-224x136.png",
contentType = 'image/png',
width = 224,
height = 136,
alt = "This is image alternate text")
})
})
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏!