Purpose: To make the image resize in response to moving the slider in Shiny (RStudio). Think of a scalable effect.
Problem: The error "Error in basename (imageinfo $ src): expected character vector argument" appeared. I can not find anything that directly answers the question, and I'm not sure what else to try. Is this just a problem with how sliderInput is used as input $ slider in server.R?
My current progress:. My rationale was to set up the slider in the ui.R file, and then get the image width in the server.R file.
Part of ui.R:
shinyUI(fluidPage( titlePanel("Nancy Brainstorming"), sidebarLayout( sidebarPanel( h3( strong("What is this?", style = "font-si24pt")), p("This is a pilot project."), sliderInput("slider", label = "", min = 100, max = 300, value = 200), imageOutput("logo", width = 200) ) ) ))
Part of server.R:
shinyServer(function(input, output) { output$logo = renderImage({ img(src = "mylogo.png", width = input$slider) }) })
Additional Information: The image appears just fine when I use img (src = "mylogo.png", width = 200). In addition, I am doing this to better understand how to create brilliant applications.
Nancy source share