Use the lightbox2 javascript
library to render image
files in an htmlwidget.
devtools::install_github("fazetu/lightbox2")library(lightbox2)Get file paths to some image files.
images <- example_images()Note there is also example_lightbox2().
These examples are not interactive, but demonstrate the different styling options available.
This R code chunk in R Markdown does not have results='asis'.
lightbox2(images)Change thumbnail size.
lightbox2(images, thumbnailHeight = "50px", thumbnailWidth = "auto")Change thumbnail alignment.
lightbox2(images, thumbnailHeight = "50px", thumbnailWidth = "auto", thumbnailAlign = "left")Make it so we get a scroll bar by adjusting thumbnail height and max height of the widget.
lightbox2(images, thumbnailHeight = "200px", thumbnailWidth = "auto", maxHeight = "200px")Adjust the size of the overall widget.
lightbox2(images, width = "50%")Don’t center within the page.
lightbox2(images, width = "50%", margin = "none")




