Fix bird avatar generation.
This commit is contained in:
parent
8a3e046386
commit
5a00ec2406
@ -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()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user