在弹出窗口中放大图-闪亮的应用程序

时间:2020-06-04 20:58:36

标签: r 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)

0 个答案:

没有答案
相关问题