|
|
|
@ -52,13 +52,22 @@ module.exports = {
|
|
|
|
if (imageMetadata) {
|
|
|
|
if (imageMetadata) {
|
|
|
|
let cover256Buffer;
|
|
|
|
let cover256Buffer;
|
|
|
|
if (imageMetadata.height > imageMetadata.width) {
|
|
|
|
if (imageMetadata.height > imageMetadata.width) {
|
|
|
|
cover256Buffer = await image.resize(256, 320).jpeg().toBuffer();
|
|
|
|
cover256Buffer = await image
|
|
|
|
|
|
|
|
.resize(256, 320)
|
|
|
|
|
|
|
|
.jpeg({
|
|
|
|
|
|
|
|
quality: 100,
|
|
|
|
|
|
|
|
chromaSubsampling: '4:4:4',
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.toBuffer();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
cover256Buffer = await image
|
|
|
|
cover256Buffer = await image
|
|
|
|
.resize({
|
|
|
|
.resize({
|
|
|
|
width: 256,
|
|
|
|
width: 256,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.jpeg()
|
|
|
|
.jpeg({
|
|
|
|
|
|
|
|
quality: 100,
|
|
|
|
|
|
|
|
chromaSubsampling: '4:4:4',
|
|
|
|
|
|
|
|
})
|
|
|
|
.toBuffer();
|
|
|
|
.toBuffer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|