Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ Imports:
magrittr,
plotly,
stats,
utils
utils,
glue,
htmltools
Suggests:
testthat
Encoding: UTF-8
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export(random_dygraph)
export(random_ggplot)
export(random_ggplotly)
export(random_image)
export(random_image_ext)
export(random_lm)
export(random_print)
export(random_table)
Expand Down
28 changes: 28 additions & 0 deletions R/random_image_ext.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#' A Random External Image from the Lorem Picsum API
#'
#' This function returns an external random image from the Lorem Picsum API that can be used directly within the Shiny UI.
#'
#' @return an external image
#'
#' @export
#'
#' @examples
#'
#' random_image_ext(width = 400, height = 600, seed = "caramba")
#'
#'

random_image_ext <- function(width = 400, height = 400, seed = NULL) {

if (is.null(seed)) {

htmltools::img(src = glue::glue("https://picsum.photos/{width}/{height}"))

} else {

htmltools::img(src = glue::glue("https://picsum.photos/seed/{seed}/{width}/{height}"))

}


}
20 changes: 20 additions & 0 deletions man/random_image_ext.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.