Skip to content

Fix resize function when only one dimension is passed#12

Open
jwhulette wants to merge 1 commit intostoryblok:masterfrom
jwhulette:fix-resize-using-only-one-dimension
Open

Fix resize function when only one dimension is passed#12
jwhulette wants to merge 1 commit intostoryblok:masterfrom
jwhulette:fix-resize-using-only-one-dimension

Conversation

@jwhulette
Copy link

This pull request updates the image resizing logic to correctly maintain aspect ratios when only one dimension (width or height) is specified, and adjusts the corresponding unit tests to reflect the new behavior.

Image resizing logic improvements:

  • Updated the resize method in Image.php to use the original aspect ratio when calculating the missing dimension, ensuring that the image scales proportionally if only width or height is provided.

Test updates:

  • Modified test cases in ImageTest.php to expect the new dimensions resulting from proportional scaling, rather than keeping the original dimensions when one value is zero.

@OskarStark OskarStark changed the title Fix resize function when only one dimension is passed. Fix resize function when only one dimension is passed Mar 19, 2026
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.39%. Comparing base (36e088c) to head (0a0a4fc).

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #12      +/-   ##
============================================
- Coverage     99.39%   99.39%   -0.01%     
  Complexity       54       54              
============================================
  Files             1        1              
  Lines           165      164       -1     
============================================
- Hits            164      163       -1     
  Misses            1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants