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
.envfile, and you can check.env.exampleto get the values which you can use. - You should have a table called images with a field called
originaland another one calledimages. - The app will read the values from
originaland save the results as JSON value toimages. - The app also will updated a field called
proccessedwhich indicate that the file has been processed or not. - Check the Schema file
ImagesTableto know more about the table structure.
- Check the Schema file
ImagesTableto 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 iscreatewhich will create the table, anddropwhich 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.