From f5c1d941dd7e62a1659641831554abb921b7823c Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Fri, 14 Sep 2018 01:51:14 +0000 Subject: [PATCH] Just guessing at this point --- commands/image-edit/demotivational-poster.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/commands/image-edit/demotivational-poster.js b/commands/image-edit/demotivational-poster.js index d96ed754..cf98b25a 100644 --- a/commands/image-edit/demotivational-poster.js +++ b/commands/image-edit/demotivational-poster.js @@ -51,9 +51,8 @@ module.exports = class DemotivationalPosterCommand extends Command { ctx.fillStyle = 'black'; ctx.fillRect(0, 0, canvas.width, canvas.height); const ratio = data.width / data.height; - const widthHigher = data.width >= data.height; - const width = widthHigher ? Math.min(Math.round(402 / ratio), 602) : 602; - const height = widthHigher ? 402 : Math.min(Math.round(602 * ratio), 402); + const width = Math.min(Math.round(data.height / ratio), 602); + const height = Math.min(Math.round(data.width * ratio), 402); const x = (canvas.width / 2) - (width / 2); const y = 44 + ((402 / 2) - (height / 2)); ctx.fillStyle = 'white';