mardi 14 avril 2015

R Shiny: fast reactive image display

I'm trying to display images in my shiny app reactively. I've successfully done that in the server.R script with:



output$display.image <- renderImage({

image_file <- paste("www/",input$image.type,".jpeg",sep="")

return(list(
src = image_file,
filetype = "image/jpeg",
height = 520,
width = 696
))

}, deleteFile = FALSE)


BUT it's very slow.


However, it is VERY fast to embed one of the images into the ui.R script like so:



tabPanel("Live Images", img(src = "img_type1.jpeg"))


Why is there such a difference? Is there any way to make the reactive images appear faster?


Aucun commentaire:

Enregistrer un commentaire