Skip to main content

Image transforming WSGI middleware

Project description

This package provides a WSGI middleware component which automatically scales images according to the width and height property in the <img> tag.

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.

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.

Credits

Malthe Borch <mborch@gmail.com> Stefan Eletzhofer <stefan.eletzhofer@inquant.de> Jeroen Vloothuis <jeroen.vloothuis@xs4all.nl>

Changelog

0.5 (released 2008-10-11)

  • Rewritten URLs are now signed by the middleware to ensure that bitblt requests are only crafted by the middleware. This is required to shield against DoS attacks. [malthe]

0.4 (released 2008-10-11)

  • Fixed path handling. [malthe]

  • Added HTML document processing which scans document for image tags and rewrite image src attribute to include “bitblt” traversing directive. This makes it work as an actual middleware, since the application semantics are then unchanged. [malthe]

  • No longer accept query parameters, but instead require traversing directive “/bitblt-<width>x<height>”. [malthe]

  • Removed functionality to MIME-type convert. [malthe]

0.3 (released 2008-10-10)

  • Made logic robust to unexpected parameters. [malthe]

  • Fixed bug where parameters would be drawn from the WSGI environment. [malthe]

  • Added mimetype conversion. [malthe]

0.2 (released 2008-10-08)

  • Fixed entry point name.

0.1 (released 2008-10-03)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repoze.bitblt-0.5.tar.gz (12.4 kB view details)

Uploaded Source

File details

Details for the file repoze.bitblt-0.5.tar.gz.

File metadata

  • Download URL: repoze.bitblt-0.5.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for repoze.bitblt-0.5.tar.gz
Algorithm Hash digest
SHA256 ad82351518b2b945343b8ce1f466e7a6f0eaf80c73b3ee7b2f21b1180dbc5ab9
MD5 f788ef8421653a0bd16b4c9a2c4f4ca6
BLAKE2b-256 383d46974c1eec58815942ef628eb588a16b4c72537f3ce75165987d6613723d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page