4 ms·
I use lambda for image uploads. The function ensures images aren’t bigger than 10mb, the image is compressed to our sizing, and put into s3.
by moomoo11 3y ago
I use lambda for image uploads.
The function ensures images aren’t bigger than 10mb, the image is compressed to our sizing, and put into s3.
- pier25 3y agoWith Google Cloud Storage you can simply set a header with the max size allowed when signing the upload URL.
- matusgallik008 3y agoI believe AWS S3 allows setting the Content-Length header as well. So you might not need the lambda
- moomoo11 3y agoCan you explain what you mean? I'm confused about the "might not need the lambda". Thanks! In my case we allow up to 10mb file upload. For example just testing something right now from my iPhone I selected a 3.7mb image which was uploaded and resized to the "frame" it will go into in the UI and its now 288kb in S3. We have a few "frame" sizes which are consistent throughout our application. Now, my cloudfront is serving 288kb file instead of 3.7mb, which is good for me because I want to avoid the bandwidth costs and users honestly can't tell the difference, and then also we aren't a photo gallery app. So in my case I need the lambda to resize the image to our "frame" sizes. I wonder if I didn't explain right. I'm ESL so just want to make sure since I'm confused about the your last sentence.
- aprilnya 3y agoThey mean you might not need the lambda if all you want to do is enforce a max size; if you want to do resizing/other processing then you’d still need the lambda
- matusgallik008 3y agoYou're good mate. I meant exaclty what aprilnya said. I thought you are using the Lambda just to validate the 10mb limit - and just for that you don't need the lambda :) and could save yourself some cents & effort. But if you do resizing as well, then ofc you need the Lambda (or some other compute engine).