marlokessler / strapi-plugin-image-optimizer

Optimize your images for desktop, tablet and mobile and different image formats.
MIT License
14 stars 10 forks source link

Expected positive integer for height but received 2779.5 of type number #27

Open longd3 opened 1 year ago

longd3 commented 1 year ago

I exactly used default config but kept getting this error:

Error: Expected positive integer for height but received 2779.5 of type number
    at Object.invalidParameterError (/node_modules/sharp/lib/is.js:135:10)
    at Sharp.resize (/node_modules/sharp/lib/resize.js:287:18)
    at sharpAddResizeSettings (/node_modules/strapi-plugin-image-optimizer/dist/server/services/image-optimizer-service.js:88:26)
    at resizeFileTo (/node_modules/strapi-plugin-image-optimizer/dist/server/services/image-optimizer-service.js:51:21)
    at generateImage (/node_modules/strapi-plugin-image-optimizer/dist/server/services/image-optimizer-service.js:42:21)
    at /node_modules/strapi-plugin-image-optimizer/dist/server/services/image-optimizer-service.js:29:46
    at Array.forEach (<anonymous>)
    at /node_modules/strapi-plugin-image-optimizer/dist/server/services/image-optimizer-service.js:28:39
    at Array.forEach (<anonymous>)
    at /node_modules/strapi-plugin-image-optimizer/dist/server/services/image-optimizer-service.js:25:15
netzpixel commented 6 months ago

Same. Why is this still open?

christophebe commented 6 months ago

Same issue

rosareyes commented 4 months ago

same?

raku3 commented 4 months ago

additionalResolutions: [1.5, 3], ↑ remove

It appears that you have resized the image and as a result the file specifies a pixel dimension with a decimal point. Files containing decimal points will result in an error