From d6ab53c9e4beff21cefc5d3aea9a39e5fca00a71 Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Thu, 30 Dec 2021 18:06:10 -0800
Subject: [PATCH] fixed a bug in json compression where if the height > width,
 it doesnt resize the image

---
 api/utils.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/api/utils.go b/api/utils.go
index 5beed9c37..96eb44f88 100644
--- a/api/utils.go
+++ b/api/utils.go
@@ -58,7 +58,7 @@ func CompressJpeg(imgBytes []byte) ([]byte, error) {
 	}
 
 	// Determine the new width of the image based on desiredSize
-	newWidth := uint(math.Sqrt(float64(desiredSize * (imgInfo.Width / imgInfo.Height))))
+	newWidth := uint(math.Sqrt(float64(desiredSize) * (float64(imgInfo.Width) / float64(imgInfo.Height))))
 
 	// Resize the image based on newWidth while preserving aspect ratio
 	newImg := resize.Resize(newWidth, 0, img, resize.Bicubic)
-- 
GitLab