shinyExpandImage: Elegant viewer functionality for images

View source: R/novoImageResizer.R

shinyExpandImageR Documentation

Elegant viewer functionality for images

Description

Elegant image viewer and resizer for images

Usage

shinyExpandImage(imageid = c())

Arguments

imageid

one or more IDs of a div containing images

Value

Feature that allows images to be easily expanded and viewed

Use case

Use in a shiny application for image(s) that you'd like to carry a viewer feature on click.

When the image is clicked, it is expanded and toolbars appear to allow the user to in zoom in or out, as well as download the image.

if there are multiple images within the imageid holder, then they are automatically ordered at the bottom for ease of transition.

Examples

# simple expansion for 2 images in a shiny app
if (interactive()) {
  shiny::shinyApp(
    ui = shiny::fluidPage(
      shinyExpandImage(c("ccgal1")),
      htmltools::tags$div(
        id = "ccgal1",
        htmltools::tags$a(
          href = "https://r2resize.obi.obianom.com/m/1b.jpg",
          htmltools::tags$img(
          src = "https://r2resize.obi.obianom.com/m/1b.jpg",
          alt="sample text for image 1")
        ),
        htmltools::tags$a(
          href = "https://r2resize.obi.obianom.com/m/1.jpg",
          htmltools::tags$img(
          src = "https://r2resize.obi.obianom.com/m/1.jpg",
          alt="sample text for image 2")
        )
      )
    ),
    server = (function(input, output) {})
  )
}


r2resize documentation built on May 29, 2024, 11:55 a.m.