Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
r2.12.18
-
None
Description
The CMS automatically generates a thumbnail version of each uploaded image by scaling down the original. The scaling fails when the original image has a very high aspect ratio, for example 2000 x 1 pixels, or 1 x 2000 pixels. The calculated width or height of the scaled image will then be less than 1, which the method org.hippoecm.frontend.plugins.gallery.ImageUtils.createScaledImage() then floors to 0 by casting it to an integer. The constructor of a BufferedImage will then throw an IllegalArgument exception, causing the whole scaling to fail.
The netto effect for a CMS user is that the upload dialog does not disappear since an error is caught during the upload. Furthermore, the image will be added but its thumbnail will not be scaled down.
Steps to reproduce:
- start the default CMS
- upload an image of 2000x1 or 1x2000 pixels
Expected behavior: a thumbnail of 0 bytes is generated
Actual behavior: an IllegalArgumentException is thrown and the generated thumbnail is equal to the original image