A containerized service for generating file previews of supported files. This uses the preview-generator python library to generate the file previews and Celery to spawn worker(s) to do the processing. This isolates the "task" of generating the file previews from the web server receiving the requests.
This requires a running Docker
Engine (or Daemon) and Compose tool.
docker-compose up -d
This will return a task_id
that can be used to check the status of the process and download the result of the process.
curl -F "file=@/path/to/image.jpg" localhost:5000/generate
A SUCCESS
status indicates that the preview is ready to be downloaded. Please see Celery Built-in States for more info.
curl localhost:5000/status/<task_id>
As stated from the Checking the Status section, the file is ready to be downloaded once the status is SUCCESS
.
curl -o preview.jpg localhost:5000/download/<task_id>