Skip to content

Conversation

@UnknownJoe796
Copy link
Contributor

The media module tests were failing because the resizeToRatio extension function was being called on line 131 of MediaPreviewOptions.kt but was never implemented. This function is needed to crop images to match a target aspect ratio.

Changes:

  • Implemented ImmutableImage.resizeToRatio() extension function that crops images from the center to achieve the target aspect ratio
  • Added import for kotlin.math.min
  • Updated TODO comments to remove completed validation items

The implementation:

  • Returns the original image if targetRatio is null or already matches
  • Crops width when image is too wide for the target ratio
  • Crops height when image is too tall for the target ratio
  • Uses center cropping to maintain the most important image content

The media module tests were failing because the resizeToRatio extension
function was being called on line 131 of MediaPreviewOptions.kt but was
never implemented. This function is needed to crop images to match a
target aspect ratio.

Changes:
- Implemented ImmutableImage.resizeToRatio() extension function that
  crops images from the center to achieve the target aspect ratio
- Added import for kotlin.math.min
- Updated TODO comments to remove completed validation items

The implementation:
- Returns the original image if targetRatio is null or already matches
- Crops width when image is too wide for the target ratio
- Crops height when image is too tall for the target ratio
- Uses center cropping to maintain the most important image content
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.

3 participants