2016-02-26 188 views
4

我有光泽的应用程序,则返回包含直接URL到托管在web上的图像的字符串。我试图找到一种方法来直接显示这个图像作为输出。ř闪亮显示输出外部托管图像

当与SRC =“图像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") 
) 
)) 

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") 
    }) 
}) 

任何帮助表示赞赏!

回答

5

你可以在服务器上使用的用户界面htmlOutput()renderText()

Server.r

src = "https://theWeb/aPictureSomewhere.jpg" 
output$picture<-renderText({c('<img src="',src,'">')}) 

ui.r

htmlOutput("picture") 
+0

我想这对于我的问题,它呈现的图像,但它不结合我可点击图片代码工作。如果你能帮上忙,那会很棒。在这里找到帖子:https://stackoverflow.com/questions/45709189/renderimage-from-url-and-clickable – Mark