Been using (and occasionally contributing to) Sharp for quite a while, both professionally and personally. Great library to have at hand when you need to deal with images.
Good library. API can be a bit quirky. Like if you want to read image size before and/or after a resize or if you do or don't want to respect the image orientation/rotation in the image meta data. I usually have to convert to a buffer and then back to Sharp again for it to reload the changes but it works!
It is an amazing library! Been using it for years. It is used in a number of projects I've created including https://benhouston3d.com and https://threekit.com for auto image resizing, format conversion and optimization.
It includes support for UltraHDR (HDR and SDR in one JPEG file), camera RAW images, and the Oklab colourspace. This should all be coming to sharp in the next six month or so.
Lots of ways to do this but generally you attach a Lambda function to an origin response. If the path meets specific conditions (is 404/403, contains specific query string param) then run the Lambda function.
So imagine if you have:
original.jpg
Then just return it from the origin.
But imagine if you have original.jpg?size=150
Run the Lambda function (in this case a Sharp resize function) on the original.jpg file and return it. It'll get cached so the next time someone calls original.jpg?size=150 it just return the 150px width image without running any function as there was never a need to hit the origin.