Astro Info
Astro v5.10.0
Node v24.2.0
System Windows (x64)
Package Manager npm
Output static
Adapter none
Integrations @astrojs/mdx
If this issue only occurs in one browser, which browser is a problem?
N/A
Describe the Bug
If you define the width and height option inside getImage(options) that do not match the original image's dimensions, then getImage() will just silently ignore the height prop.
Since cropping to fit-center may not be the desired outcome, this makes sense, but then Astro should warn that the input image's aspect ratio does not match that of the specified options.
Example:
// Import someImage that is 3:2 (300 x 200)
import someImage from '@/assets/someImage.png';
// Attempt to resize it to 3:1 (30:10)
const resizedImage = await getImage({
src: someImage,
width: 30,
height: 10,
});
/* getImage() respects the `width` option and scales the image down, but ignores `height`, resulting in a 30x20 image */
What's the expected result?
Show a warning (or error, severity configurable in Astro settings?) if the image aspect ratio does not match when using getImage() and it appears that the user is attempting to crop the image
Link to Minimal Reproducible Example
N/A, StackBlitz doesn't allow image uploads without a paid membership. See above for reproducible code snippet
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
N/A
Describe the Bug
If you define the
widthandheightoption insidegetImage(options)that do not match the original image's dimensions, thengetImage()will just silently ignore theheightprop.Since cropping to fit-center may not be the desired outcome, this makes sense, but then Astro should warn that the input image's aspect ratio does not match that of the specified options.
Example:
What's the expected result?
Show a warning (or error, severity configurable in Astro settings?) if the image aspect ratio does not match when using
getImage()and it appears that the user is attempting to crop the imageLink to Minimal Reproducible Example
N/A, StackBlitz doesn't allow image uploads without a paid membership. See above for reproducible code snippet
Participation