This is just a simple CLI application which can be used as simple microservice to get images url from the database and resize them based on the configureations you have.
- Create a new
.env
file, and you can check.env.example
to get the values which you can use. - You should have a table called images with a field called
original
and another one calledimages
. - The app will read the values from
original
and save the results as JSON value toimages
. - The app also will updated a field called
proccessed
which indicate that the file has been processed or not. - Check the Schema file
ImagesTable
to know more about the table structure.
- Check the Schema file
ImagesTable
to know more about the table structure.
The app has two main commands :
process
: which is the main command to process the images, and takes no arguments at all.setup
: which can create a simple images table which you can use, the default argument iscreate
which will create the table, anddrop
which will drop the table.
You need to make sure that the file resizer
is executable,
and if you like you can create a cron job which will execute the process the images every min or so.
This code is licensed under the MIT license.