[MGNLIMG-214] maxSizeComplyingWithSourceRatio fails when height is not set Created: 25/Jul/19  Updated: 29/Aug/22

Status: Open
Project: Imaging
Component/s: image operations
Affects Version/s: 3.4.2
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Christian Bachmann Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: maintenance, to-verify
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Team: DeveloperX

 Description   

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.


Generated at Mon Feb 12 02:13:24 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.