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
#' @examples
#' random_image()

random_image <- function(){
  l <- list.files(system.file("img", package = "shinipsum"), full.names = TRUE)
  img <- normalizePath(sample(l, 1))
  tmpimg <- tempfile()
  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 1, 2020, 1:07 a.m.