fix: tall originals no longer stop the image variants job

A width whose variant would be taller than the thumbnailer's 4096 px
edge limit is skipped with a warning and counted, like a width wider
than the original, so the job and journal:image-variants go on with the
next widths and images.
This commit is contained in:
Jakub Zych
2026-11-04 23:12:43 +01:00
parent 311c28af3a
commit 45d66f6071
3 changed files with 69 additions and 2 deletions

View File

@@ -192,6 +192,14 @@ func GenerateImageVariants(ctx context.Context, db *gorm.DB, bucket *blob.Bucket
continue
}
h := max(1, int((int64(sh)*int64(w)+int64(sw)/2)/int64(sw)))
if h > MaxImageWidth {
// A tall original (an infographic): the variant would leave
// the thumbnailer's edge limit, so this width is skipped like
// one wider than the original, and the job goes on.
variantsLog.Warn("journal: no image variant taller than the edge limit", "file", f.ID, "width", w, "height", h, "max", MaxImageWidth)
out.Skipped++
continue
}
key, err := f.ThumbKey(ctx, bucket, w, h, ImageVariantsMode)
if err != nil {
return out, fmt.Errorf("journal: thumbnail %d at %d: %w", f.ID, w, err)