https://github.com/akrabat/bref-image-resizer
Serverless PHP (Bref/Lambda) function to resize an image on upload to an S3 bucket
https://github.com/akrabat/bref-image-resizer
bref lambda php s3 serverless
Last synced: 8 months ago
JSON representation
Serverless PHP (Bref/Lambda) function to resize an image on upload to an S3 bucket
- Host: GitHub
- URL: https://github.com/akrabat/bref-image-resizer
- Owner: akrabat
- License: mit
- Archived: true
- Created: 2019-05-15T11:02:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-15T14:56:32.000Z (about 7 years ago)
- Last Synced: 2025-01-28T11:38:16.985Z (over 1 year ago)
- Topics: bref, lambda, php, s3, serverless
- Language: Makefile
- Size: 9.77 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bref-image-resizer
When an image is uploaded to the S3 bucket, then this lambda is triggered which will create a thumbnail version and
upload it back into the S3 bucket.
## Installation
* Copy `Makefile.dist` to `Makefile` and change `UNIQUE_KEY`.
* `composer install`
* `make setup`
* `make deploy`
## To run
* Upload an image file into your `-images` bucket.
* Wait a second or two.
* List the files in the S3 bucket and see that the `-thumb` version now exists.
(Check the logs if it doesn't turn up using `make lastlog`.)
## Notes
* This function uses [Bref](https://bref.sh).
* This function needs Imagick which is provided by a separate layer.
* This function is called by S3 whenever a new file is added to the bucket, so we have to check that we don't resize the thumbnail files!