Uploaded image for project: 'Imaging'
  1. Imaging
  2. MGNLIMG-214

maxSizeComplyingWithSourceRatio fails when height is not set

XMLWordPrintable

      info.magnolia.imaging.operations.cropresize.Size provides the method 

      maxSizeComplyingWithSourceRatio. In my case, I set the width to 400. The acutal image has a resolution of 1920x1200, so it needs to get resized.  If you not set the height in your image variation (it is an optional value), then the maxHeight will result in 0. According to my debugger, this results in a maxWidth 400, maxHeight 0, sourceRatio 1.6, tentativeWidth 400 and tentativeHeight 250. There is a check on line 94, which checks if the tentativeHeight is equals or smaller than the maxHeight. From my point of view, there is a check missing, if the maxHeight is 0. This would prevent in my case, that the size is calculated in the else block based on the width, which is 0, and causes in the end a 500 response, with no image shown.

        Acceptance criteria

              Unassigned Unassigned
              chris Christian Bachmann
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:

                  Bug DoR
                  Task DoD