Wolfgang Rolke
Wolfgang Rolke

Reputation: 855

deleteFile = FALSE in renderImage not working

I have a problem with the deleteFile = FALSE argument of renderImage. In short it deletes the image file anyway.

As a short test example i have the ui.R

 library(shiny)              
 shinyUI(fluidPage(
   titlePanel("Testing ..."),  
   sidebarLayout(   
       sidebarPanel(),            
       mainPanel(
          imageOutput("f1")
       )
   )     
 ))

and the server.R

library(shiny)

shinyServer(function(input, output,session) {

   output$f1 <- renderImage({
      list(src="f1.png", deleteFile = FALSE)
   }) 
})

where f1.png is some png image file. When i run this it displays the image ok, but also deletes it from the folder, exactly what deleteFile = FALSE is supposed to not do.

I am on a Win7 machine, in case that matters.

Wolfgang

Added: I now found another way to do this, using

output$f1 <- renderText({
    HTML("<img src=\"f1.png\">")
})

and uiOutput in ui.R, and this works fine, but the original question remains, why does shiny delete the image files despite the deleteFile=FALSE argument?

Wolfgang

Upvotes: 4

Views: 1476

Answers (1)

Mikael Jumppanen
Mikael Jumppanen

Reputation: 2486

Try:

library(shiny)

shinyServer(function(input, output,session) {

   output$f1 <- renderImage({
      list(src="f1.png")
   }, deleteFile = FALSE) 
})

Upvotes: 8

Related Questions