Recently I had to implement an image gallery within a
shiny application. A simple grid of small images where clicking opens the fullscreen image. Nothing complicated, but I did have several requirements:
- The gallery needed to render from a folder of images
- The gallery interface and thumbnails needed to be responsive
- The gallery needed to link to other
- The fullsize image should be zoomable to see the full resolution.
images <- data.frame(src = list.files('www/img')) %>% tidyr::separate(col = 'src', c('txt', 'date', 'time', 'msec'), sep = '_|\\.', remove = FALSE) %>% rowwise() %>% mutate(date = lubridate::ymd(date), key = hashids::encode(1e3 + as.integer(msec), hashid_settings(salt = 'this is my salt')))