Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@resourcefulhumans/rheactor-image-service
Advanced tools
Readme
An image processing backend running on AWS Lambda.
Uses gm with GraphicsMagick (which is available by default) on AWS lambda.
It takes JPEG or PNG images that are uploaded base64 encoded, crops and resizes them on the fly to 256x256px size, and stores them on an S3 bucket.
Original | Result |
---|---|
JPEG | JPEG |
600x300 | 256x256 |
PNG | JPEG |
600x300 | 256x256 |
JPEG | JPEG |
300x600 | 256x256 |
Users need to provide an JsonWebToken which is checked against the configured public key.
POST /upload
Content-Type: application/vnd.resourceful-humans.rheactor-image-service.v1+json
Authorization: Bearer <token>
{
"$context":"https://github.com/ResourcefulHumans/rheactor-image-service#Upload",
"image":"R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
"mimeType":"image/png"
}
Content-Type: application/vnd.resourceful-humans.rheactor-image-service.v1+json
{
"$context":"https://github.com/ResourcefulHumans/rheactor-image-service#UploadResult",
"url":"https://s3.eu-central-1.amazonaws.com/rheactor-image-service/example.com/33f24f55-e435-4198-a148-fdd1095ffa96-user-5.jpg",
"mimeType":"image/jpeg"
}
This implementation expects token's sub
to be an URL, which will be used to prefix and suffix URLs.
A sub
value of https://example.com/user/5
was used in the example above.
These environment variables need to be set on the lambda function:
S3_BUCKET
rheactor-image-service
to where files are uploaded.S3_REGION
MOUNT_URL
WEB_LOCATION
PUBLIC_KEY_FILE
npm install
# Configure these environment variables
AWS_ROLE=…
AWS_ACCESS_KEY_ID=…
AWS_SECRET_ACCESS_KEY=…
AWS_REGION=…
AWS_FUNCTION_NAME=…
NODE_ENV=…
VERSION=…
# install this as a new lambda function
make install
For local testing use AWS SAM CLI.
It has docker as a dependency. To start local testing run sam local start-api
command. It will read template.yml
and create local container with built function.
It is required to build the project first - all files must be in build folder.
Because lambda function is not setting any additional CORS headers, easiest way is to use nginx to append them. Config for that is included in repo.
FAQs
An image processing backend running on AWS Lambda.
The npm package @resourcefulhumans/rheactor-image-service receives a total of 8 weekly downloads. As such, @resourcefulhumans/rheactor-image-service popularity was classified as not popular.
We found that @resourcefulhumans/rheactor-image-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.