Async thumbnail
Offload sorl thumbnail rendering to a render view.
Installation
pip install async-thumbnail
Usage
# settings.py
INSTALLED_APPS = (
# ...
'async_thumbnail',
# ...
)
# urls.py
urlpatterns = [
# ...
path('', include('async_thumbnail.urls')),
# ...
]
{% load async_thumbnail %}
<!-- Default -->
<img src="{% async_thumbnail object.image "900x600" crop="center" %}">
<!-- Save as var -->
{% async_thumbnail object.image "900x600" crop="center" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
FetchFromCacheMiddleware
When you use the default full page caching middleware, it may be a good idea to replace it with this middleware. This prevents cache from being updated when the content contains a render URL.
# settings.py
MIDDLEWARE = (
'django.middleware.cache.UpdateCacheMiddleware',
# ...
'async_thumbnail.middleware.FetchFromCacheMiddleware',
)
Settings
ASYNC_THUMBNAIL_ENDPOINT
Default: ''
Optional setting to determine an absolute path for rendering.
ASYNC_THUMBNAIL_PATTERN_NAME
Default: 'async_thumbnail:render'
Pattern name for render URL’s.
Metadata
Release files for async-thumbnail 2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| async_thumbnail-2.3.tar.gz | 8.5 kB | Without provenance | Details for async_thumbnail-2.3.tar.gz |
Release files / async_thumbnail-2.3.tar.gz
| Download URL | async_thumbnail-2.3.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcad449211e49a25438c53a2d3b2fd39410a1bc804d1b1df4aeafbed087d6207
|
|
BLAKE2b-256 checksum How to use checksums |
22751007dab9aca8c32967e4bcd489a1e632932551e0c507dbd361e127472a4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
|
Security for async-thumbnail 2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.