Fix resize function when only one dimension is passed#12
Open
jwhulette wants to merge 2 commits intostoryblok:masterfrom
Open
Fix resize function when only one dimension is passed#12jwhulette wants to merge 2 commits intostoryblok:masterfrom
jwhulette wants to merge 2 commits intostoryblok:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Author
|
@OskarStark I have updated my PR to follow the APi conventions, https://www.storyblok.com/docs/api/image-service/operations/resize#proportional |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the behavior of the
resizemethod in theImageclass and its associated tests. The main change is that when either the width or height is set to zero, the method now sets the corresponding dimension to zero instead of calculating it to preserve the original aspect ratio. This simplifies the logic and makes the method's behavior more explicit when a zero value is provided.Key changes:
Image resizing logic:
resizemethod inImage.phpso that if eitherwidthorheightis zero, the dimension is set to zero directly, rather than automatically calculating it to maintain the aspect ratio.Test adjustments:
ImageTest.phpto reflect the new behavior: resizing with a zero width or height now results in a dimension of zero, not a calculated value based on the original aspect ratio.