Description Usage Arguments Examples
These functions are like most fooOutput()
and renderFoo()
functions in the shiny package. The former is used to create a
container for a gallery, and the latter is used in the server logic to
render the gallery.
1 2 3 | galleryOutput(outputId, width = "100%", height = "150px")
renderGallery(expr, env = parent.frame(), quoted = FALSE)
|
outputId |
The |
width |
The width of the input container, e.g., |
height |
The height of each input image, e.g., |
expr |
An expression to create an image gallery widget (normally via
|
env |
The environment in which to evaluate |
quoted |
Is |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
library(shinygallery)
get_uri <- function(file) {
file_ext <- paste0("image/", tools::file_ext(file))
base64enc::dataURI(file = file, mime = file_ext)
}
file_path <- system.file("extdata", package = "shinygallery")
files <- list.files(file_path, full.names = TRUE)
values <- rep(sapply(files, get_uri), 10)
ui <- fluidPage(galleryOutput("gallery"))
server <- function(input, output, session) {
output$gallery <- renderGallery({
gallery(values, height = 150, options = list(
"detailsLabel" = "Details", "addLabel" = "Add"
))
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.