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)
}

Try the shinipsum package in your browser

Any scripts or data that you put into this service are public.

shinipsum documentation built on May 29, 2024, 2:30 a.m.