R/Image.R

Defines functions random_image

Documented in random_image

#' A Random Image
#'
#' This function returns a random image that can be passed into `renderImage` and `plotOutput`.
#'
#' @return an image
#'
#' @export

random_image <- function(){
  l <- list.files(system.file("img", package = "shinipsum"), full.names = TRUE)
  img <- normalizePath(sample(l, 1))
  tmpimg <- paste(tempfile(), basename(img), sep = "-")
  file.copy(img, tmpimg)
  list(src = tmpimg)
}
ThinkR-open/shinipsum documentation built on Feb. 10, 2024, 2:16 a.m.