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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | deeb6e923bfc7839dbdb07847c24b2ab14951b2ba805dc16156bf5af825578f1 |
|
MD5 | c510ba564740e62e6d510eb33752f8a1 |
|
BLAKE2b-256 | 3712f351834baa99b4aeaa8f2512e8eeb07c57d096cff7f4e1fcab42d0fc961c |
Hashes for django_image_dimensions-0.0.1-py2.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccf4761ce11d1ea94bb85ffe9048fd70a25ac1b9ded02e62f55a49cccb5ec717 |
|
MD5 | 9e6daffefa657c99af832c1cf60423c9 |
|
BLAKE2b-256 | 26c8db42f72ecc69d3b9992bb200942d7b6b0aadadf084e62f51a2b020990eee |