Image-Manager
Service for image managing (download, save, serve, delete)
Start with docker-compose
- It needs running redis
- It needs config file
See example https://github.com/idolgoff/image-manager/tree/main/docker
How to use it
Single image mode
POST /v1/queue/image
body: {
"imageUrl": "https://www.silverdisc.co.uk/sites/default/files/sd_importer/lion_webp_10.webp",
"webHook": "http://ya.ru"
}
it returns
{
"jobId": "3473c73e-720b-48bf-884f-983099fbc181"
}
GET /v1/queue/image?jobId=3473c73e-720b-48bf-884f-983099fbc181 returns job status
{
"result": "completed"
}
ToDo
- Main processing pipeline
- Check config at start time (reduce costs at runtime)
- Check errors resistance
- Add queue management
- Add queue UI
- Add tune settings (concurency, rateLimit and so on)
- Extract config from code
- Cover with tests
Params
Сonfig
{
mainDir: [path1, path2, ...],
sets: [{
type: 'thumb' | 'bigImage' | ...whatever,
subPath: string, // path + subpath
size?: { width?: number, height?: number }, // if only one side set then image size will be processed proportionately
}]
}
Main usage
Image manager is used for download, process and store images with given urls. It is usefull for e-commerce catalog processing.
prepare data -> 2) queue -> 3) processing (download -> manipulate -> store) -> 4) callback
- Input params format (JSON)
{data: {imageUrl, meta, webHook}}
webHook - POST api endpoint getting {...data, ...processingResult}
- Queue Use api endpoint
/queue/add
Input params as FormData
-
Processing
- Download
- Manipulate
- Store
-
Callback
API Interface
/v1/ prefix
- /queue
- /image
- POST add new image job
- GET get job status
- /images
- POST add images job
- GET get job status
- /image
- /images
- remove ?query ???
Core modules
- fastify - http server
- bull - for queue management
- bull-board - Bull's UI (view status)
- sharp