Fix bird avatar generation.

This commit is contained in:
John Livingston 2024-02-09 17:28:16 +01:00
parent 8a3e046386
commit 5a00ec2406
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC

View File

@ -126,19 +126,20 @@ const path = require('node:path')
continue continue
} }
const bodyFile = computeFilename('body', i) const firstPart = Object.keys(parts)[0]
const firstFile = computeFilename(firstPart, i)
// We just have to combinate different parts into one file, then output at the wanted size. // We just have to combinate different parts into one file, then output at the wanted size.
const composites = [] const composites = []
let j = 0 let j = 0
for (const part of Object.keys(parts).filter(p => p !== 'body')) { for (const part of Object.keys(parts).filter(p => p !== firstPart)) {
j++ // introduce an offset so we don't get all empty parts at the same time j++ // introduce an offset so we don't get all empty parts at the same time
composites.push({ composites.push({
input: computeFilename(part, i + (j * 7)) input: computeFilename(part, i + (j * 7))
}) })
} }
const buff = await sharp(bodyFile) const buff = await sharp(firstFile)
.composite(composites) .composite(composites)
.toBuffer() .toBuffer()