Usage with AWS Serverless Image Handler

Here’s the handler:

Basically - it does image processing for us, but we don’t want to download any images as we generate that “derivatives”, and we don’t want to upload anything to S3 (and we don’t even care much about metadata really).

So it seems like derivatives plugin does not really fit in this case. (It would if we wanted to upload that image, and/or cared about the metadata of those processed images.)

What we could do instead:

And, I guess that’s the best and most flexible way of doing it, so Shrine is not even directly involved in all that serverless image handling at all! :slight_smile:

Funny, it was kinda a question when I was about to write it, and in progress of writing I’ve already figured it out. But I’ve already written it, so maybe that’s something that might be added to Shrine documentation somewhere (and also reviewed by someone like Janko first :slight_smile:).

Thank you for sharing the link to AWS Serverless Image handler. We always figured that was another solution to generating derivatives once AWS Lambda was introduced and it’s good to see AWS incorporate it as dev’s were implementing it themselves.

As you mentioned, in that scenario Shrine does not need to be directly involved when it comes to derivatives and that is fine because we want to maximize developer flexibility when possible as there are many types of file processing needs to cater for from pdf’s, images, videos, packaging, etc.

The AWS image handler uses libvips library and that library has image file format limitations when compared to ImageMagick so it may not serve everyone’s needs. In addition to the derivatives plugin, we also have the derivation_endpoint plugin which allows you to create on-demand derivatives with the option to store the derivative or not. Maybe that can be a better fit to use AWS Image handler on support file formats or do your own processing for unsupported image formats. It all depends on what you’re looking to build. :slight_smile:

@FunkyloverOne I agree keeping Shrine out of the way seems like a good choice here. What do you think about creating a wiki page showing integration with Serverless Image Handler? We could even create a small Shrine plugin that allows you to generate these URLs, similar to shrine-imgix.

Sure, good idea, so we are going to integrate it anyway on our project, then I think we will take a look at this plugin you’ve sent, create a similar one, and then publish the final version to the community :slight_smile: