我正在使用来自shinywidgets selectizeInput 的作者的这个链接和图像/图标 来创建一个带有图像的选择输入(已经在 www 文件夹中),在本地运行良好,但图像不显示在闪亮的服务器上,我没有错误,只是图像不显示,只有一个空白方块和标签。
这是代码:
output$ui.menu.mosaicos <- renderUI({
#Could you use an action button, and set the style='background-img:path/to/img;'
#imagenes por cargar (mosaico - mosNOMBRE.png)
mosData <<- data.frame("mosaico" = list.files("www/", "mos[A-Z0-9]",
all.files = FALSE,
full.names = TRUE))%>%
mutate("nombres" = str_extract(mosaico,"[A-Z0-9].+\\.")%>%gsub("\\.", "", .),
"picker" = gsub("www/","", mosaico))
filling <- mosData%>%pivot_wider(-mosaico,names_from = nombres,values_from = picker)
selectizeInput(inputId = "pickMosaico",
label = "Mosaicos",
width = "200px",
choices = filling,
options = list(
render = I(
"{
option: function(item, escape) {
return '<div><img src=\"' + item.value + '\" width = 160 />' + escape(item.label) + '</div>'
}
}"))
)
})