11# Serverless Sharp Image Processor
2- A solution to dynamically optimize and transform images on the fly, utilizing [ Sharp] ( https://sharp.pixelplumbing.com/en/stable/ ) .
2+ A solution to dynamically optimize and transform images on the fly, utilizing [ Sharp] ( https://sharp.pixelplumbing.com/en/stable/ ) and AWS Lambda .
33
44## Who is this for?
5- This software is for people who want to optimize and transform (crop, scale, convert, etc) images from an existing S3
5+ This software is for people who want to optimize and run basic transformations (crop, scale, convert, etc) on images from an existing S3
66bucket without running computationally expensive processes or servers or paying for expensive third-party services.
77
8+ Serverless Sharp is written to be a drop-in replacement for most essential features of Imgix and costs magnitudes less for
9+ most users.
10+
811## How does it work?
912After deploying this solution, you'll find yourself with a number of AWS resources (all priced based on usage rather
1013than monthly cost). The most important of which are:
@@ -24,6 +27,10 @@ For example: `mybucket/images`
2427- ` SECURITY_KEY ` See security section
2528- ` SLS_IGNORE ` A comma-delineated string of paths that should be ignored (for example, ` favicon.ico ` )
2629
30+ You can define multiple environments, each of which will inherit your default settings. This is useful if you have
31+ different buckets for staging & production, for example. You may also wish to create an environment without a sign-key
32+ for local development.
33+
2734## API & Usage
2835We chose to base our API around the [ Imgix service] ( https://docs.imgix.com/apis/url ) to allow for backwards compatibility
2936with the already popular service. The idea is that all CMS plugins should be able to seamlessly use this service in-place of
@@ -120,14 +127,9 @@ This package uses Serverless to allow for local development by simulating API Ga
1201275 . Run ` serverless offline `
121128
122129## Deploying to AWS
123- First, we need to procure sharp/libvips binaries compiled for Amazon Linux. We can do this by running the following:
124-
125- ```
126- npm run sharp:linux
127- ```
128-
129- This will remove any existing Sharp binaries and then reinstall them with Linux x64 in mind.
130-
131- Ensure your ` settings.yml ` file is properly configured as shown in the previous steps
130+ Ensure your ` settings.yml ` file is properly configured as shown in the previous steps.
132131
133132Run: ` serverless deploy [--stage=dev] [--settings=settings.yml] `
133+
134+ If you need to deploy using a specific AWS profile, you should run:
135+ ` AWS_SDK_LOAD_CONFIG=true serverless deploy [--stage=dev] [--settings=settings.yml] --aws-profile PROFILE_NAME `
0 commit comments