Automatically add dimension attributes to all <img> tags in a response to improve rendering speed on the client.
Project description
Automatically add dimension attributes to all <img> tags in a response to improve rendering speed on the client.
##Rationale
Specifying image dimensions in HTML improves both percieved and actual client-side rendering performance by preventing reflow. However, maintaining explicit dimensions in templates is tedious and impractical in some cases. This middleware solves that in a plug-and-play manner by automatically setting dimensions in all &img& tags in a response.
##Requirements
django-celery to run image fetch and dimensions calculations in the background
PIL
A cache that is shared between web server and celery (e.g. memcached)
##Installation 1. Run pip install django-image-dimensions 2. Add ‘imagedimensions’ app to INSTALLED_APPS 3. Add ‘imagedimensions.middleware.ImageDimensionsMiddleware’ to MIDDLEWARE_CLASSES
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
Built Distribution
Hashes for django-image-dimensions-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e5612f362786c65cec2df5dac9fb03e683a3ebbc25d83bdf724983849389735 |
|
MD5 | 18ad8c2c102acc6cb8462797fe501532 |
|
BLAKE2b-256 | 4bbee432d6575476aa9fb12eac8cdcdc1e13706e4e204a30c34d49fece0b9b2c |
Hashes for django_image_dimensions-0.0.2-py2.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7c3d8be39db6ac7527a0cd7cfec9175dc99d6754f82239a5140875a42c222d9 |
|
MD5 | 5b5a6edc3f3bcdc910b80290e70200b1 |
|
BLAKE2b-256 | faf0f7bf716a0c5ea290f9e4ebdc8eba825397ace5b2b9714412702b8333922b |