I have a Shiny application that returns a character string containing the direct URL of an image posted on the Internet. I am trying to find a way to display this image directly as output.
When using renderImage () with src = "image url" the application does not display the image.
Here is an example of a problem:
ui.R
library(shiny)
shinyUI(fluidPage(
headerPanel("render externally hosted Image example"),
mainPanel(
imageOutput("myImage")
)
))
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")
})
})
Any help is appreciated!
source
share