Search code examples
node.jsamazon-s3aws-lambdamulterminio

how to save different size of an image in minIO?


I'm currently working on a ecommerce application with Nodejs & React.
I'm using minIO as s3 storage server and in order to make images more flexible and optimized in different screens and locations I was wonder if there's any possibility to save different sizes of an image like what we do with AWS lambda, instead of generating image sizes in backend server (nodejs) ?


Solution

  • S3 is storage, and only supports transformations via the s3 select feature, which isn't relevant for images.

    You have 2 options. Both require some external setup:

    1. Pre-scale images. You can set up a bucket notification, that will listen for uploads and trigger a remote Lambda function that downloads the image, scales it to a predefined set of sizes and stores them back, maybe in a different bucket.

    2. Call a lambda function. It should then internally download the image from S3, scale it and return it at the requested size. This sounds like what you are doing.