JonasKruckenberg / imagetools

Load and transform images using a toolbox :toolbox: of custom import directives!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When source image size exactly matches the requested width it is excluded from the generated output

PickleyD opened this issue · comments

import myImage from 'image.png?w=980;490'

If image.png is 980px wide exactly only the 490px size is included in the generated output, meaning that in my app at screen sizes >980px the small 490px image is displayed. Is this a bug?

If image.png is larger than 980px then the 980px size is generated as I expected.

To work around this issue temporarily I can add the 979px size which is still generated where image.png is 980px exactly:

import myImage from 'image.png?w=980;979;490'

maybe try

import myImage from 'image.png?w=980;490&allowUpscale=true'

bf391fd

@benmccann

I hit the same issue with vite-imagetools 5.0.4.
I also have the 4.0.12 in another project and I don't recall this issue popping up before, which makes me think it's a new one.

allowUpscale works (although it's not in the directives documentation), but it's a temporary workaround and this is definitely a bug.

Thank you @dgeibi for the workaround. I agree with you @pavlo-tk that this should be considered a bug given the context you have both provided.

I believe this issue was address. Can you please test again?

This was fixed July 6 in 5.0.5. I'm going to close this as fixed since all the comments are from before that date