Resized image using asynchronous helper using sharp
-
I am trying to use the sharp library and use a global asynchronous helper to handle the resize. it works well for once but second time it will failed and terminate the whole jsreport instance giving.
terminate called after throwing an instance of 'Napi::Error'
2022-04-10T09:42:51.270747300Z what():Searching further it it linked to the release of the resources
https://github.com/lovell/sharp/issues/2263
which recommend to include the library in main thread. I would like to ask for jsreport where can I load the library in main thread?
-
I will recall this design as there still limit on the handlebar on the size. This approach put lot of pressure in catering the handlebar data in dataURL format. Its better to setup an image proxy and use URL in the template to refer to the resized image. The performance is much better as well.