Image processing service used to rezise images from Amazon S3 bucket dynamically..
- Nodejs v10 or higher
- pm2
- nodemon
Make a copy from .env_default
file and rename the file with .env
,
PORT
: this is the port the service will bindAMAZON_S3_BUCKET
: this will be the url from your amazon S3 bucket
install node modules
npm install
then you can run the service
npm start #this will boot the service using pm2
for development
npm run dev #run with nodemon
npm run inspect #run with nodemon and debugger enabled
http://localhost:3000/v1/image/rk4eRm.jpg?w=200
:image_name: amazon_bucket filename
#returns -> Image
query params
Name | Type | Possible values | Required | Note |
---|---|---|---|---|
w (width) | number | any number > 0 | false | |
h (height) | number | any number > 0 | false | |
fit | string | cover, contain, fill, inside, outside | false | |
position | string | top, right top, right, right bottom, bottom, left bottom, left, left top | false | fit = cover or contain default is center |
strategy | string | entropy, attention | false | only works with fit = cover |
gravity | string | north, northeast, east, southeast, south, southwest, west, northwest, center, centre | false |
returns -> { "status": "ok" }