1.0.3 • Published 8 years ago

lamda-resize v1.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

lambda-resize

Circle CI

Resizes images and puts them in a matching directory on the given bucket, suffixing them with the resized width. Also creates @2x variants.

Usage

export SIZES="88,100"
export ENVIRONMENT="staging"
export DESTINATION_BUCKET="destination_bucket"
node-lambda deploy \
  --description "Resize uploaded images to $SIZES on $DESTINATION_BUCKET" \
  --environment "$ENVIRONMENT" \
  --accessKey "AWS_KEY" \
  --secretKey "AWS_SECRET" \
  --functionName "${ENVIRONMENT}-resize-on-upload" \
  --handler index.handler \
  --role "AWS_LAMBDA_ARN" \
  --description "Creates resized copies of images on $DESTINATION_BUCKET when uploads occur"<Paste>

Usage in CI/CD

This function is designed to be deployed from a CD pipeline such as CircleCi. See the deploy.sh script for the expected environment variables.export SIZES="88,100"

Output

For an image with the key /kittens/cute.jpg at bucket kittens-originals and the following config.json:

{
  "destinationBucket": "kittens-resized",
  "sizes": [
    88, 100, 1024
  ]
}

The function will create the following resized files in the kittens-resized bucket:

/kittens-resized/cute.w88.jpg
/kittens-resized/cute.w88.@2x.jpg
/kittens-resized/cute.w100.jpg
/kittens-resized/cute.w100.@2x.jpg
/kittens-resized/cute.w1024.jpg
/kittens-resized/cute.w1024.@2x.jpg
1.0.3

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago