Font smaller and chop top part of image
This commit is contained in:
parent
dfa2a8e414
commit
4317ed8e56
1 changed files with 14 additions and 3 deletions
|
@ -79,7 +79,7 @@ class posterCommand extends Command {
|
||||||
const BOTTOM_POS = (value.height / 2) - PADDING + 180;
|
const BOTTOM_POS = (value.height / 2) - PADDING + 180;
|
||||||
//const FONT_SIZE1 = 50;
|
//const FONT_SIZE1 = 50;
|
||||||
const FONT_SIZE1 = (value.width / 12);
|
const FONT_SIZE1 = (value.width / 12);
|
||||||
const FONT_SIZE2 = (value.width / 12) - 20;
|
const FONT_SIZE2 = (value.width / 12) - 50;
|
||||||
//const FONT_SIZE2 = 30;
|
//const FONT_SIZE2 = 30;
|
||||||
|
|
||||||
// Write text on image using graphicsmagick
|
// Write text on image using graphicsmagick
|
||||||
|
@ -94,6 +94,10 @@ class posterCommand extends Command {
|
||||||
.drawText(0, TOP_POS, TOP_TEXT, TEXT_POS)
|
.drawText(0, TOP_POS, TOP_TEXT, TEXT_POS)
|
||||||
.font(FONT, FONT_SIZE2)
|
.font(FONT, FONT_SIZE2)
|
||||||
.drawText(0, BOTTOM_POS, BOTTOM_TEXT, TEXT_POS)
|
.drawText(0, BOTTOM_POS, BOTTOM_TEXT, TEXT_POS)
|
||||||
|
.write(output, function(err) {
|
||||||
|
// Chop the top part of the image
|
||||||
|
let img2 = gm(output);
|
||||||
|
img2.chop(0, 100)
|
||||||
.write(output, function(err) {
|
.write(output, function(err) {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -102,6 +106,13 @@ class posterCommand extends Command {
|
||||||
}
|
}
|
||||||
return message.channel.send({files: [output]});
|
return message.channel.send({files: [output]});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
return message.channel.send('An error just occured! is it a static image?');
|
||||||
|
}
|
||||||
|
//return message.channel.send({files: [output]});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue