Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-4525

Scaling of images with extreme aspect ratio caused IllegalArgumentException

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • r2.12.18
    • r2.17.00
    • front-end-core
    • 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

      Attachments

        1. 2000x1.png
          2000x1.png
          0.2 kB
        2. 4525_logs.txt
          9 kB
        3. CO2_bubbles_1x2000.jpg
          CO2_bubbles_1x2000.jpg
          10 kB
        4. CO2_bubbles_2000x1.jpg
          CO2_bubbles_2000x1.jpg
          10 kB

        Activity

          People

            jsheriff Junaidh Kadhar Sheriff
            mdenburger Mathijs den Burger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: