【发布时间】:2018-07-22 01:10:18
【问题描述】:
我正在尝试使用闪亮显示 png 文件。文件已上传但未正确显示。我已经包含了 ui 和服务器代码
ui <- fluidPage(
titlePanel("Upload Slide Image"),
sidebarLayout(
sidebarPanel(fileInput("file1", "Choose png File", multiple = TRUE,
accept = c(".png")) ), # Input: Select a file ----
mainPanel(imageOutput("myImage"))
)
)
server <- function(input, output, session){
output$myImage <- renderImage({
outfile <- tempfile(fileext = '.png')
png(outfile, width = 400, height = 300) # Generate the PNG
dev.off()
list(src = outfile,contentType = 'image/png',width = 400, height = 300,
alt = "This is alternate text")
}, deleteFile = TRUE)
}
# Create Shiny app ----
shinyApp(ui, server)
【问题讨论】:
-
您似乎没有对边栏中提供的
fileInput执行任何操作