library(htmltools)
roll_imag <- function(pattern,path,text_tag,height = 300){
imags_path <- list.files(
path = path,pattern = pattern,
full.names = TRUE
)
imags_tag <- lapply(imags_path,function(x){
tags$img(
src = x,
style = paste0("display: inline-block; height: ",height,"px;")
)
}
)
html <- tags$div(
tags$div(
imags_tag,
style = "white-space: nowrap; overflow-x: auto; width: 100%;"
),
tags$div(
tags$p(text_tag),
style = paste("text-align: center; margin-top: 10px; font-size:",
"18px", ";")
)
)
return(browsable(html))
}
roll_imag(pattern = ".png$",path = "../picture/",text_tag = "example text")example text