Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.
/ change-dpi Public archive

RESTful interface to imagemagick's density methods

License

Notifications You must be signed in to change notification settings

chevalvert/change-dpi

Repository files navigation

change-dpi

provide a RESTful interface to imagemagick's density method


Installation

$ git clone https://github.com/chevalvert/change-dpi
$ cd change-dpi
$ yarn install

Development

$ yarn start
> $ NODE_ENV=development node index.js
> Server is listenning on http://<ip>:<port>

Usage

Launch

basic
$ node change-dpi
> Server is listenning on http://192.168.1.54:8888
daemon with pm2
$ pm2 start change-dpi --log-date-format 'YY-MM-DD HH:mm:ss'
$ pm2 save
$ pm2 startup
$ pm2 log change-dpi
> YY-MM-DD HH:mm:ss: Server is listenning on http://<ip>:<port>

API Endpoints

GET /api/ping

response

A 200 HTTP status code with the following JSON document:

{
  "version": "major.minor.patch"
}
example
$ curl -X GET http://localhost:8888/api/ping
> {"version":"1.0.0"}%

POST /api/dpi/<dpi>/<?format>

request

The api expects the request body to be a multipart/form-data encoded form data.
The <format> argument is optionnal.

response

A 201 HTTP status code with the resulting file attached to the response (see expressjs#res.download).

In case of an error, the api will return a 500 HTTP status code with the following JSON document:

{
  "error": "error message"
}
example
<html>
  <body>
    <form
      action='http://localhost:8888/api/dpi/300/pdf'
      method='post'
      encType="multipart/form-data">
        <input type="file" name="inputFile" />
        <input type='submit' value='convert' />
    </form>
  </body>
</html>

Configuration

change-dpi use a .env file for configuration. See .env.example.

License

MIT.

About

RESTful interface to imagemagick's density methods

Resources

License

Stars

Watchers

Forks

Packages

No packages published