resize _all_ of the covers, not just the root

This commit is contained in:
Nick Pegg 2025-05-07 22:01:23 -07:00
parent aca297e7de
commit 955f5833cc
2 changed files with 8 additions and 3 deletions

View file

@ -159,8 +159,12 @@ fn generate_images(config: &Config, album: &AlbumDir, full: bool) -> anyhow::Res
let output_path = album.path.join(&config.output_dir);
let mut all_images: Vec<&Image> = album.iter_all_images().collect();
// also resize cover image
all_images.push(&album.cover);
// also resize cover images, since we didn't count those as part of the image collections
let mut album_queue: VecDeque<&AlbumDir> = VecDeque::from([album]);
while let Some(album) = album_queue.pop_front() {
all_images.push(&album.cover);
album_queue.extend(&album.children);
}
println!("Generating images...");
let progress = ProgressBar::new(all_images.len() as u64);

View file

@ -46,6 +46,7 @@ impl AlbumDir {
pulldown_cmark::html::push_html(&mut description, parser);
} else {
if filename.to_string_lossy().starts_with("cover") {
log::debug!("Found explicit cover for {}", p.display());
cover = Some(Image::new(
entry_path.strip_prefix(root)?.to_path_buf(),
String::new(),
@ -112,7 +113,7 @@ impl AlbumDir {
}
}
let cover = cover.ok_or(anyhow!("Could not find a cover image for {}", p.display()))?;
log::debug!("Cover for {} is {cover:?}", p.display());
log::debug!("Cover for {} is {}", p.display(), cover.path.display());
Ok(AlbumDir {
path: p.strip_prefix(root)?.to_path_buf(),