Fix Incorrect Mapping of 'fit' Attribute Values in imgix Configuration #1104
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.
Context:
This PR addresses a specific issue in the nuxt-image library's imgix.ts file, which is responsible for configuring the imgix service integration. The imgix service provides functionality to manipulate images, including the use of the 'fit' attribute to control how images are adjusted to fit within specified dimensions.
Problem:
The value 'fill' for the 'fit' attribute is incorrectly mapped to 'scale'. This misalignment results in unexpected behavior, as the 'fill' and 'scale' values dictate different fitting strategies for images:
Here is how Scale attribute behaves
Here is how Fill attribute behaves
Issue:
Due to this incorrect mapping, when users specify 'fill' for the 'fit' attribute in their imgix configuration, the system defaults to the 'scale' behavior. This issue persists even when 'fill' is explicitly passed through modifiers, leading to a significant deviation from expected functionality.
Solution:
This PR proposes a modification to the imgix.ts configuration file. The goal is to correctly map the 'fit' property so that specifying 'fill' will accurately invoke the 'fill' behavior, rather than defaulting to 'scale'. It also adds the scale value to the values dictionary. This change will ensure that users leveraging the imgix service through nuxt-image will experience the expected behavior when they specify the 'fit' attribute for their images.
Impact:
This change will provide a more reliable and intuitive experience for developers using imgix with nuxt-image, ensuring that image fitting options perform as documented.