Skip to content
Snippets Groups Projects
Commit d6ab53c9 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

fixed a bug in json compression where if the height > width, it doesnt resize the image

parent 779a3fed
No related branches found
No related tags found
1 merge request!117Release
...@@ -58,7 +58,7 @@ func CompressJpeg(imgBytes []byte) ([]byte, error) { ...@@ -58,7 +58,7 @@ func CompressJpeg(imgBytes []byte) ([]byte, error) {
} }
// Determine the new width of the image based on desiredSize // 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 // Resize the image based on newWidth while preserving aspect ratio
newImg := resize.Resize(newWidth, 0, img, resize.Bicubic) newImg := resize.Resize(newWidth, 0, img, resize.Bicubic)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment