Natim / Thumbnailer

A service that take an url and returns a thumbnail
9 stars 2 forks source link

core: implement some Python API around engines #9

Open benoitbryon opened 12 years ago

benoitbryon commented 12 years ago

See also #7. If engines are pluggable, then thumbnailer's wsgi application will have to :

And engines will have to conform to some API.

Proposal for the core methods:

Proposal for engines:

Advantage of passing file objects:

  1. the wsgi app receives the request
  2. thumbnailer's core reads configuration, then determine which reader, writer and engine to use
  3. thumbnailer passes the request to the reader, which returns a file object. Default implementation reads an URL passed in the request and returns an Image.
  4. thumbnailer passes the file object to the engine, which returns another file object. It reads options (width and height) in the request.
  5. thumbnailer passes the file object to the writer, which transforms it to an HTTP response. Default implementation returns an image as HTTP response.

With this design: