A simple package for downloading and collaging photos from online sources. magick
does all the heavy lifting. You can download the development version from GitHub with:
devtools::install_github("jaytimm/photomoe")
library(tidyverse)
tweet_pics <- rtweet::search_tweets("#standwithukraine", n = 1000, include_rts = F) %>% filter(!is.na(media_url))
photomoe::img_download_images(link = unlist(tweet_pics$media_url)[1:49], dir = tempdir(), prefix = 'uk', scale_border = T)
The img_build_collage
function builds a collage per a user specified directory of images -- based on the magick
package and this very nice post.
photomoe::img_build_collage(dir = tempdir(), dimx = 7, dimy = 7, prefix = 'uk')
search1 <- 'pointing at rainbows' search2 <- 'piano keys' links <- lapply(list(search1, search2), photomoe::img_get_gurls) head(links[[1]])
photomoe::img_download_images(link = links[[1]], dir = tempdir(), prefix = search1, scale_border = T) photomoe::img_build_collage(dir = tempdir(), dimx = 5, dimy = 4, prefix = search1)
photomoe::img_download_images(link = links[[2]], dir = tempdir(), prefix = search2, scale_border = T) photomoe::img_build_collage(dir = tempdir(), dimx = 5, dimy = 4, prefix = search2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.