我想把一个动作按钮,缩放和放大图像在我闪亮的应用程序。请参阅下面的代码,shiny应用根据用户的选择渲染两个图像“space_1.jpg”和“space_2.jpg”(已经创建)。这个想法将允许用户在弹出窗口中放大图像。我不知道如何让它成为可能。非常感谢你的帮助
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
sidebarPanel(width=6,
radioButtons("choice", label = h4("Choose"),choices = c("space_1","space_2"), selected = "space_1"),
dropdown(downloadButton(outputId = "down_image_test",label = "Download plot"),size = "xs",icon = icon("download", class = "opt"), up = TRUE),
actionBttn(inputId = "zoom_image_test",icon = icon("search-plus", class = "opt"),style = "fill",color = "danger",size = "xs")
),
mainPanel(h2("main panel"),imageOutput('image_test'))
)
server <- function(input, output){
output$image_test <- renderImage({
nam=paste0(getwd(),"/",input$choice,".jpg")
list(src = nam,height = 200)}, deleteFile = FALSE)
output$down_image_test <- downloadHandler(
filename = "test.jpg",
content = function(file) {
nam=paste0(getwd(),"/",input$choice,".jpg")
file.copy(nam, file)
})
}
shinyApp(ui,server)
1条答案
按热度按时间zysjyyx41#
也许是这样的:
代码非常科塞,你可以自己修改。