Giter VIP home page Giter VIP logo

lambda-image-manager's Introduction

Lambda Image Manager

Lambda Image Manager is AWS Lambda function that store, get, manipulate images in AWS S3.

If you are using Cloudinary or Imgix like service just for resizing or basic image manipulation, maybe you don't need them anymore.

Before Start

If you aren't used to Serverless or AWS Lambda, I highly recommend that read Serverless docs first.

Remember! AWS provides free tier amount, but this whole service is not FREE.

Todo List

  • Add DynamoDB logic.

Prerequisites

  • Make empty AWS S3 bucket for image file store. - Make and set AWS DynamoDB for cache.(Not supported yet)

Installing

git clone https://github.com/TylorShin/lambda-image-manager.git
cd lambda-image-manager
npm install

And set production environment. (If you want to stage or other)

# /env/prod.yml
S3_BUCKET_NAME: lambdaImage
S3_DEST_PREFIX: images/original

The S3 folder structure should be like below.

# lambdaImage Bucket

/root
  /images
    /original

Then if you ready to deploy Serverless project, just run

npm run deploy:prod

IMPORTANT

Set API Gateway (this image is actually from my own service by using this repository)

You should set lambda-image-manager's API Gateway's binary support option.

At API Gateway setting page, set binary option allow header to "image/*". Then, Deploy API Gateway once again in console dashboard.

Running the tests

WIP

How It Works

getImage

  • A browser try to presentation tag with src property heading our API gateway that trigger lambda function.
  • Lambda get request with image id, image file name, image manipulation options.
  • Trying to find pre-manipulated result from AWS DynamoDB as cache. If the target image is already manipulated with same option, then read that image's address from DynamoDB and return redirect response to that address.
  • If there is no cache, manipulate target image with given options.
  • Change the image to Buffer with BASE64 encode.
  • After that, store the result to S3 and record result address to DynamoDB with manipulation options.
  • return manipulated target image to user.

Built With

Contributing

WIP

Authors

  • Tylor Shin - Project Manager - TylorShin
  • breath103 - Tech lead & Initial idea maker - breath103

License

WIP

lambda-image-manager's People

Contributors

tylershin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.