Well the error we were having is gone but I now have this
stack: “Error: Expected integer for top but received -120 of type number↵ at Object.invalidParameterError (/opt/node_app/node_modules/sharp/lib/is.js:101:10)↵ at Sharp. (/opt/node_app/node_modules/sharp/lib/resize.js:375:16)↵ at Array.forEach ()↵ at Sharp.extract (/opt/node_app/node_modules/sharp/lib/resize.js:370:38)↵ at App.crop (/opt/node_app/lib/modules/image.js:191:21)↵ at App._exec (/opt/node_app/lib/core/app.js:427:57)↵ at App._exec (/opt/node_app/lib/core/app.js:398:28)↵ at async App.exec (/opt/node_app/lib/core/app.js:367:9)↵ at async App.define (/opt/node_app/lib/core/app.js:357:9)”
This is with an image of 1920w x 1000h, so I would need it to upscale the 1000h to 1080 first, then crop to a final 1920w x 1080h
Then I tried a file of 2000w x 708h, similar error
stack: “Error: Expected integer for top but received -558 of type number↵ at Object.invalidParameterError (/opt/node_app/node_modules/sharp/lib/is.js:101:10)↵ at Sharp. (/opt/node_app/node_modules/sharp/lib/resize.js:375:16)↵ at Array.forEach ()↵ at Sharp.extract (/opt/node_app/node_modules/sharp/lib/resize.js:370:38)↵ at App.crop (/opt/node_app/lib/modules/image.js:191:21)↵ at App._exec (/opt/node_app/lib/core/app.js:427:57)↵ at App._exec (/opt/node_app/lib/core/app.js:398:28)↵ at async App.exec (/opt/node_app/lib/core/app.js:367:9)↵ at async App.define (/opt/node_app/lib/core/app.js:357:9)”
So i tried an image larger in both dimensions 2016w x 1512h and got this
- {status: “500”, message: “extract_area: bad extract area↵”,…}
- message: “extract_area: bad extract area↵”
- stack: “Error: extract_area: bad extract area↵”
- status: “500”
EDIT: If i disable the crop step after the resize step, it resizes perfectly, then I have to redeploy to refresh the cache, and can see all the images at the correct sizes.
EDIT 2: If I then disable the resize step and save, redeploy, then crop works too, on redeploy i can see all 3 images now at 1920 x 1080.
Doing one more test as something went strange with image 4, so just testing again.
EDIT 3: Ok image 4 makes sense, it starts off at 2016w x 1512h so once the resize takes the height down to 1080h, the width drops way below the 1920w, and then the crop fails.
Going to have to try add some conditions or something to check if the width is not going to drop too much, its like height is 1080px if min-width doesnt go under 1920px.
Anyway so final result is that, they both work, just not together, I am going to go out on a limb here and say its because of the cache, I can clear cache, or disable it in dev tools, etc. but the only way this shows the new sizes is to redeploy and then refresh, so maybe its unaware of the new image parameters. Lol, I try be clever.