2016-02-26 82 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