shiny server instance crashes after capture button click.
First, thanks for this package!
I am trying to use get pixels from a shiny app that I am building on my shiny server.
Server.R
library(shiny)
library(pixels)
server <- function(input, output) {
show_pixels(
round(runif(400, 0, 1)),
grid = c(40, 10),
size = c(800, 200),
params = list(fill = list(color = "#FF3388"))
)
output$pixels <- shiny_render_pixels(
show_pixels()
)
digit <- reactiveVal(floor(runif(1, 1, 10)))
output$prompt <- renderText(paste0("Please draw number ", digit(), ":"))
observeEvent(input$captureDigit, {
digit_path <- file.path("digits", digit())
if (!dir.exists(digit_path)) dir.create(digit_path, recursive = TRUE)
saveRDS(input$pixels, paste0(digit_path, "/", as.numeric(Sys.time()), ".rds"))
digit(floor(runif(1, 1, 9)))
output$pixels <- shiny_render_pixels(
show_pixels()
)
})
}
UI.R
library(shiny)
library(pixels)
fluidPage(
tags$head(
tags$style(HTML("
#pixels {
height: 270px !important;
margin-top: 10px;
}
"))
),
titlePanel("Digit Capture Application"),
textOutput("prompt"),
shiny_pixels_output("pixels"),
actionButton("captureDigit", "Capture")
)
Issue
On my shiny server, when I click the capture button it will save the image in the appropriate folder, but then it crashes and gives this warning in chrome console: "failed: One or more reserved bits are on: reserved1 = 0, reserved2 = 1, reserved3 = 1". Any ideas?
Let me give it a shot...
I was able to run it just fine from RStudio... I'm on OS X, can you share your sessionInfo()? Does this trigger for you within RStudio or as a proper shiny app?
Rsudio version worked just fine. It only happened when I served it on our shiny server.
sessionInfo() R version 3.4.3 (2017-11-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.5 LTS
Matrix products: default BLAS: /usr/lib/libblas/libblas.so.3.0 LAPACK: /usr/lib/lapack/liblapack.so.3.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] shiny_1.0.5 pixels_0.1.0
loaded via a namespace (and not attached):
[1] htmlwidgets_1.0 compiler_3.4.3 R6_2.2.2 htmltools_0.3.6 tools_3.4.3 yaml_2.1.18
[7] Rcpp_0.12.16 digest_0.6.15 xtable_1.8-2 httpuv_1.3.6.2 miniUI_0.1.1 mime_0.5