Kult Resizer is a simple PHP utility which can be used to resize images coming from an Amazon AWS S3 bucket. The images are resized and served on-the-fly but there's also a caching mechanism in order to optimize performance. It also supports subfolders, up to 1 level. The tool is meant to run as a standalone microservice, however it can also be included in an existing PHP project.
The easiest way to run this locally is with Docker.
First create a file on root level called
Then put here the environmental variables:
||the name of the directory for the cached images. I recommend to use
||the URL of your S3 bucket.|
||when something doesn't work it's difficult to understand what's going on. Set this to
When this is done you can run it:
docker-compose up --build
Now that the service is running you can see it at work.
This means that the image will be resized in a way that the bigger side will be 400px.
If your file is not in a subfolder, but on the root level of the bucket ( i.e. https://s3.eu-central-1.amazonaws.com/atw-images/logo.jpg ) just omit the folder parameter, like this:
This means that the image will have max. width of 400px and max. height of 200px. The resulting image will be a proportioned image fitting inside these dimensions.
Currently only JPGs are supported. PNGs should be supported as well.
There is no cropping logic. It might be interesting to introduce a square-crop feature
Make debug mode logging less crappy :)
Add a way to flush the cache without needing to re-deploy the service or manually delete the cache folder