-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.txt
70 lines (49 loc) · 2.34 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Overview
========
This package provides a WSGI middleware component which automatically
scales images according to the ``width`` and ``height`` property in
the <img> tag.
To configure the middleware, pass in a string for ``secret``; this may
be any string internal to the system.
You can also set ``filter`` to select the scaling filter. The available
filters are ``nearest``, ``bilinear``, ``bicubic`` and ``antialias``. The
default is ``antialias``.
If you want to change the compression level for JPEG images, then you can set
the ``quality`` option to a value between 1 (worst) and 95 (best). The default
is 80.
By default all image URLs are rewritten. With ``limit_to_application_url``
you can limit the rewriting to relative URLs and absolute URLs below the
application URL.
A minimal cache implementation is available with the ``cache``
parameter. It should be the path to a directory where generated images
will be saved. This is a very simplistic approach that does not use
any possibly related HTTP header at all: ``Last-Modified``,
``Expires``, etc. The only way to refresh or empty the cache is to
delete the files. This feature is disabled by default.
Usage
-----
The middleware operates in two phases, on HTML documents and images
respectively.
When processing HTML documents, it looks for image tags in the
document soup::
<img src="some_image.png" width="640" height="480" />
In the case it finds such an image element, it rewrites the URL to
include scaling information which the middleware will read when the
image is served through it.
The image will be proportionally scaled, so it fits into the given size. If
you only set one of width or height, then the image will only be limited to
that, but still proportionally scaled.
This effectively means that application developers needn't worry about
image scaling; simply put the desired size in the HTML document.
Note that this middleware is protected from DoS attacks (which is
important for any middleware that does significant processing) by
signing all URLs with an SHA digest signature.
Contributing
------------
The development of repoze.bitblt happens at github: https://github.com/repoze/repoze.bitblt
Credits
-------
* Malthe Borch <[email protected]>
* Stefan Eletzhofer <[email protected]>
* Jeroen Vloothuis <[email protected]>
* Florian Schulze <[email protected]>