| Title: | Responsive HTML Image Gallery |
|---|---|
| Description: | HTML image gallery in R with responsive layout and lightbox. |
| Authors: | Roy Francis [aut, cre] (ORCID: <https://orcid.org/0000-0001-8654-3580>) |
| Maintainer: | Roy Francis <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.2.1 |
| Built: | 2026-05-18 08:54:07 UTC |
| Source: | https://github.com/royfrancis/pixture |
Launches interactive shiny demo app
launchApp(app = "pixgallery", ...)launchApp(app = "pixgallery", ...)
app |
A character string denoting the app. Options are "pixfigure", "pixgallery", "pixgallery-simple", "pixcarousel". |
... |
Parameters are passed to |
This function does not return anything
## Not run: library(pixture) launchApp() ## End(Not run)## Not run: library(pixture) launchApp() ## End(Not run)
Creates an image carousel
pixcarousel( path, caption = NULL, caption_valign = "none", caption_halign = "left", link = TRUE, caption_lightbox = TRUE, gap = "0px", border_radius = "0px", shuffle = FALSE, fit = "cover", position = "center", carousel = list(), lightbox = list(), h = "400px", width = NULL, height = NULL, elementId = NULL )pixcarousel( path, caption = NULL, caption_valign = "none", caption_halign = "left", link = TRUE, caption_lightbox = TRUE, gap = "0px", border_radius = "0px", shuffle = FALSE, fit = "cover", position = "center", carousel = list(), lightbox = list(), h = "400px", width = NULL, height = NULL, elementId = NULL )
path |
A character vector of full paths to images. |
caption |
A character vector of captions for the images. If used, it must be equal to the length of path. |
caption_valign |
A character denoting position of the caption. Options are 'none', 'top', 'center' or 'bottom'. |
caption_halign |
A character denoting horizontal justification of the caption. Options are 'left', 'center' or 'right'. |
link |
A logical or character vector. What happens when you click on the thumbnail? TRUE opens up the lightbox, FALSE to disable the lightbox. A character vector of custom URLs equal to length of path. |
caption_lightbox |
A logical or character vector. TRUE shows caption in lightbox, FALSE disables caption in lightbox. A character vector of characters equal to length of path. |
gap |
A character denoting spacing between thumbnails in valid CSS units. Applied to left and right of each image. |
border_radius |
A character denoting corner radius of the carousel in valid CSS units. |
shuffle |
A logical indicating whether images are randomly shuffled. |
fit |
String. Passed to object-fit CSS property. |
position |
String. Passed to object-position CSS property. |
carousel |
A list of options to customize the carousel. See details. |
lightbox |
A list of options to customize the lightbox. See details. |
h |
A character denoting height of the image thumbnails in valid CSS units. |
width |
A character denoting width of the widget in valid CSS units. |
height |
A character denoting height of the widget in valid CSS units. |
elementId |
A character string denoting parent container ID. |
carousel options
The carousel can be customized by passing a list of options to the carousel parameter. Here is an example;
pixcarousel( paths, carousel = list( slidesToShow = 3, slidesToScroll = 2 ) )
The available options for carousel can be found at https://github.com/NickPiscitelli/Glider.js or https://nickpiscitelli.github.io/Glider.js/.
lightbox options:
The lightbox can be customized by passing a list of options to the lightbox parameter. Here is an example;
pixcarousel( paths, lightbox = list( touchNavigation = FALSE, loop = TRUE ) )
The available options for glightbox can be found at https://github.com/biati-digital/glightbox?tab=readme-ov-file#lightbox-options.
library(pixture) paths <- c( "https://images.pexels.com/photos/572897/pexels-photo-572897.jpeg", "https://images.pexels.com/photos/7604425/pexels-photo-7604425.jpeg", "https://images.pexels.com/photos/4666748/pexels-photo-4666748.jpeg", "https://images.pexels.com/photos/4932184/pexels-photo-4932184.jpeg", "https://images.pexels.com/photos/4210900/pexels-photo-4210900.jpeg", "https://images.pexels.com/photos/3126574/pexels-photo-3126574.jpeg", "https://images.pexels.com/photos/167699/pexels-photo-167699.jpeg", "https://images.pexels.com/photos/1376201/pexels-photo-1376201.jpeg" ) pixcarousel(paths) # local example ## Not run: library(pixture) paths <- list.files(path=system.file("extdata/images",package="pixture"),full.names=TRUE) pixcarousel(paths) ## End(Not run)library(pixture) paths <- c( "https://images.pexels.com/photos/572897/pexels-photo-572897.jpeg", "https://images.pexels.com/photos/7604425/pexels-photo-7604425.jpeg", "https://images.pexels.com/photos/4666748/pexels-photo-4666748.jpeg", "https://images.pexels.com/photos/4932184/pexels-photo-4932184.jpeg", "https://images.pexels.com/photos/4210900/pexels-photo-4210900.jpeg", "https://images.pexels.com/photos/3126574/pexels-photo-3126574.jpeg", "https://images.pexels.com/photos/167699/pexels-photo-167699.jpeg", "https://images.pexels.com/photos/1376201/pexels-photo-1376201.jpeg" ) pixcarousel(paths) # local example ## Not run: library(pixture) paths <- list.files(path=system.file("extdata/images",package="pixture"),full.names=TRUE) pixcarousel(paths) ## End(Not run)
Output and render functions for using pixcarousel within Shiny applications and interactive Rmd documents.
pixcarouselOutput(outputId, width = "100%", height = "400px") renderPixcarousel(expr, env = parent.frame(), quoted = FALSE)pixcarouselOutput(outputId, width = "100%", height = "400px") renderPixcarousel(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a pixcarousel |
env |
The environment in which to evaluate |
quoted |
Is |
Create a simple sequential layout of images
pixfigure( path, caption = NULL, link = TRUE, caption_lightbox = TRUE, h = "auto", w = "100%", fit = "cover", position = "center", lightbox = list(), width = "100%", height = "100%", elementId = NULL )pixfigure( path, caption = NULL, link = TRUE, caption_lightbox = TRUE, h = "auto", w = "100%", fit = "cover", position = "center", lightbox = list(), width = "100%", height = "100%", elementId = NULL )
path |
A character vector of full paths to images. |
caption |
A character vector of captions for the images. If used, it must be equal to the length of path. |
link |
A logical or character vector. What happens when you click on the image? TRUE opens up the lightbox, FALSE to disable the lightbox. A character vector of custom URLs equal to length of path. |
caption_lightbox |
A logical or character vector. TRUE shows caption in lightbox, FALSE disables caption in lightbox. A character vector of characters equal to length of path. |
h |
A character denoting height of the image in valid CSS units. |
w |
A character denoting width of the image in valid CSS units. |
fit |
String. Passed to object-fit CSS property. |
position |
String. Passed to object-position CSS property. |
lightbox |
A list of options to customize the lightbox. See details. |
width |
A character denoting width of the widget as a string in valid CSS units. |
height |
A character denoting height of the widget as a string in valid CSS units. |
elementId |
A character string denoting parent container ID. |
lightbox options
The lightbox can be customized by passing a list of options to the lightbox parameter. Here is an example;
pixfigure( paths, lightbox = list( touchNavigation = FALSE, loop = TRUE ) )
The available options for glightbox can be found at https://github.com/biati-digital/glightbox?tab=readme-ov-file#lightbox-options.
library(pixture) paths <- c( "https://images.pexels.com/photos/572897/pexels-photo-572897.jpeg", "https://images.pexels.com/photos/7604425/pexels-photo-7604425.jpeg", "https://images.pexels.com/photos/4666748/pexels-photo-4666748.jpeg" ) pixfigure(paths) # local example ## Not run: library(pixture) paths <- list.files(path=system.file("extdata/images",package="pixture"),full.names=TRUE) pixfigure(paths) ## End(Not run)library(pixture) paths <- c( "https://images.pexels.com/photos/572897/pexels-photo-572897.jpeg", "https://images.pexels.com/photos/7604425/pexels-photo-7604425.jpeg", "https://images.pexels.com/photos/4666748/pexels-photo-4666748.jpeg" ) pixfigure(paths) # local example ## Not run: library(pixture) paths <- list.files(path=system.file("extdata/images",package="pixture"),full.names=TRUE) pixfigure(paths) ## End(Not run)
Output and render functions for using pixfigure within Shiny applications and interactive documents.
pixfigureOutput(outputId, width = "100%", height = "auto") renderPixfigure(expr, env = parent.frame(), quoted = FALSE)pixfigureOutput(outputId, width = "100%", height = "auto") renderPixfigure(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a pixfigure |
env |
The environment in which to evaluate |
quoted |
Is |
Create an image gallery
pixgallery( path, caption = NULL, caption_valign = "none", caption_halign = "left", link = TRUE, caption_lightbox = TRUE, h = NULL, w = NULL, gap = "5px", border_radius = "0px", layout = "grid", shuffle = FALSE, lightbox = list(), width = "100%", height = "100%", elementId = NULL )pixgallery( path, caption = NULL, caption_valign = "none", caption_halign = "left", link = TRUE, caption_lightbox = TRUE, h = NULL, w = NULL, gap = "5px", border_radius = "0px", layout = "grid", shuffle = FALSE, lightbox = list(), width = "100%", height = "100%", elementId = NULL )
path |
A character vector of full paths to images. |
caption |
A character vector of captions for the images. If used, it must be equal to the length of path. |
caption_valign |
A character denoting position of the caption. Options are 'none', 'top', 'center', 'bottom' or 'below'. |
caption_halign |
A character denoting horizontal justification of the caption. Options are 'left', 'center' or 'right'. |
link |
A logical or character vector. What happens when you click on the thumbnail? TRUE opens up the lightbox, FALSE to disable the lightbox. A character vector of custom URLs equal to length of path. |
caption_lightbox |
A logical or character vector. TRUE shows caption in lightbox, FALSE disables caption in lightbox. A character vector of characters equal to length of path. |
h |
A character denoting height of the image thumbnails in valid CSS units. |
w |
A character denoting width of the image thumbnails in valid CSS units. |
gap |
A character denoting spacing between thumbnails in valid CSS units. |
border_radius |
A character denoting corner radius of image thumbnails in valid CSS units. |
layout |
A character denoting gallery layout type. Options are "grid", "fixed", "mosaic", "masonry", "justified", "scroll", "elastic", "rhombus" or "hexagon". See details. |
shuffle |
A logical indicating whether images are randomly shuffled. |
lightbox |
A list of options to customize the lightbox. See details. |
width |
A character denoting width of the widget in valid CSS units. |
height |
A character denoting height of the widget in valid CSS units. |
elementId |
A character string denoting parent container ID. |
layout options
grid: Grid responsive layout. Width is fluid to fit parent. When using caption_valign options 'top', 'bottom' or 'center', height cannot be adjusted.
fixed: Same as grid but with strictly fixed dimensions. Defaults to square image. When using caption_valign options 'top', 'bottom' or 'center', note that long captions may overflow. Manually set height in this case.
mosaic: Grid layout with mixed sizes.
masonry: Column layout where images flow vertically. Image height cannot be set.
justified: Similar to masonry but images flow horizontally. Image width cannot be set. When using caption_valign options 'top', 'bottom' or 'center', note that long captions are clipped. Option 'below' may cause images to be stretched if captions are too long.
elastic: Single row layout where images are magnified on hover. Image width cannot be set. Captions cannot be displayed on thumbnails.
scroll: Single row layout with horizontal scrolling. Images go offscreen. Thumbnail height and width can be set.
rhombus: Diamond shaped layout. When using caption_valign options 'top', 'bottom' or 'center', long captions are clipped. Option 'below' is disabled.
hexagon: Hexagon shaped layout. When using caption_valign options 'top', 'bottom' or 'center', long captions are clipped. Option 'below' is disabled.
lightbox options
The lightbox can be customized by passing a list of options to the lightbox parameter. Here is an example;
pixgallery( paths, lightbox = list( touchNavigation = FALSE, loop = TRUE ) )
The available options for glightbox can be found at https://github.com/biati-digital/glightbox?tab=readme-ov-file#lightbox-options.
library(pixture) paths <- c( "https://images.pexels.com/photos/572897/pexels-photo-572897.jpeg", "https://images.pexels.com/photos/7604425/pexels-photo-7604425.jpeg", "https://images.pexels.com/photos/4666748/pexels-photo-4666748.jpeg", "https://images.pexels.com/photos/4932184/pexels-photo-4932184.jpeg", "https://images.pexels.com/photos/4210900/pexels-photo-4210900.jpeg", "https://images.pexels.com/photos/3126574/pexels-photo-3126574.jpeg", "https://images.pexels.com/photos/167699/pexels-photo-167699.jpeg", "https://images.pexels.com/photos/1376201/pexels-photo-1376201.jpeg" ) pixgallery(paths) # local example ## Not run: library(pixture) paths <- list.files(path=system.file("extdata/images",package="pixture"),full.names=TRUE) pixgallery(paths) ## End(Not run)library(pixture) paths <- c( "https://images.pexels.com/photos/572897/pexels-photo-572897.jpeg", "https://images.pexels.com/photos/7604425/pexels-photo-7604425.jpeg", "https://images.pexels.com/photos/4666748/pexels-photo-4666748.jpeg", "https://images.pexels.com/photos/4932184/pexels-photo-4932184.jpeg", "https://images.pexels.com/photos/4210900/pexels-photo-4210900.jpeg", "https://images.pexels.com/photos/3126574/pexels-photo-3126574.jpeg", "https://images.pexels.com/photos/167699/pexels-photo-167699.jpeg", "https://images.pexels.com/photos/1376201/pexels-photo-1376201.jpeg" ) pixgallery(paths) # local example ## Not run: library(pixture) paths <- list.files(path=system.file("extdata/images",package="pixture"),full.names=TRUE) pixgallery(paths) ## End(Not run)
Output and render functions for using pixgallery within Shiny applications and interactive documents.
pixgalleryOutput(outputId, width = "100%", height = "100%") renderPixgallery(expr, env = parent.frame(), quoted = FALSE)pixgalleryOutput(outputId, width = "100%", height = "100%") renderPixgallery(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a pixgallery |
env |
The environment in which to evaluate |
quoted |
Is |