7
我想添加一個圖像,位於我的電腦,但它不工作。我創建了一個test.html文件,當我用我的瀏覽器(firefox)打開它時,它會呈現圖像。但是當我試圖用Shiny使用相同的代碼時,它不起作用。以下是我正在嘗試的代碼:用html添加本地圖像到一個閃亮的應用程序
#html Code
<!DOCTYPE html>
<html>
<head>
<title>
Corinthians
</title>
</head>
<body>
<p>
Vai corinthians
</p>
<img id="stats_logo" align="right" src="file:///H://lab/comunicacao/logo hyper/logo_hyp.jpg" />
</body>
</html>
## Shiny Code
headerPanel_2(
HTML(
'<div id="stats_header">
Relatório de Horas
<a href="http://hyperativa.com.br/" target="_blank">
<img id="stats_logo" align="right" alt="" src="file:///H://lab/comunicacao/logo hyper/logo_hyp.jpg" />
</a>
</div>'
), h3, "Relatório de Horas"
)
而這裏是函數headerPane_2。我使用:
headerPanel_2 <- function(title, h, windowTitle=title) {
tagList(
tags$head(tags$title(windowTitle)),
h(title)
)
}
在代碼中的關鍵的東西,我認爲,是 「SRC =」 文件:/// H://實驗室/ comunicacao /標誌超/ logo_hyp.jpg」。這是怎麼回事?我怎麼說閃亮我的電腦上的文件在哪裏?
謝謝。事後看來,這很明顯。 =) –
'img(src =「...」)'沒有'www'也能工作嗎? –
如果您使用html文件,則必須使用www文件夾,但您可以在此文件夾中創建新的文件夾結構。在我的情況下,我有不同的文件夾:圖像,js,css。 – Braisly