Thumbor image scaling for Plone — replaces in-ZODB scales with Thumbor URLs
Project description
plone-pgthumbor
Thumbor image scaling for Plone — replaces in-ZODB scales with Thumbor redirect URLs.
Instead of generating and storing scaled images in ZODB annotations (via Pillow), this package intercepts Plone's image scaling and returns signed Thumbor URLs. Thumbor fetches the original blob directly from PostgreSQL, scales on demand, and caches the result — no image data ever enters ZODB.
How it works
Plone generates signed Thumbor URLs and either embeds them directly or redirects to them — it never processes image data itself.
Classic Plone / direct @@images traversal
Browser Plone Thumbor PostgreSQL
| | | |
| GET @@images/ | | |
| image/preview | | |
|------------------>| | |
| 302 to Thumbor | | |
|<------------------| | |
| | |
| GET /sig/fit-in/400x0/<zoid>/<tid> | |
|------------------------------------------------>| |
| | SELECT data |
| | FROM blob_state |
| |--------------------> |
| |<---------------------|
| 200 scaled JPEG (Thumbor cache hit) | |
|<------------------------------------------------| |
Volto / REST API (image_scales metadata)
At catalog index time, Plone pre-computes absolute Thumbor URLs for every scale and stores them in the image_scales catalog metadata. Volto reads these directly from the REST API response and renders <img src="https://thumbor/..."> — no redirect hop at all.
In both cases Thumbor retrieves blobs via zodb-pgjsonb-thumborblobloader: local disk cache first, then PostgreSQL bytea, with optional S3 fallback. Cache busting is automatic — the blob TID in the URL changes whenever the image is updated.
Requirements
- zodb-pgjsonb — ZODB storage with PostgreSQL JSONB + blob_state table
- zodb-pgjsonb-thumborblobloader — Thumbor loader reading from blob_state
- Thumbor >= 7.0
- Plone 6.2+
Installation
pip install plone.pgthumbor
Add to your Plone site's GenericSetup profile dependencies or install via the Add-ons control panel.
Configuration
| Environment Variable | Default | Description |
|---|---|---|
PGTHUMBOR_SERVER_URL |
(required) | Public Thumbor base URL, e.g. http://thumbor:8888 |
PGTHUMBOR_SECURITY_KEY |
(required) | Shared HMAC-SHA1 signing key |
PGTHUMBOR_UNSAFE |
false |
Use /unsafe/ URLs instead of signed — dev only |
Environment variables take precedence over Plone registry settings (IThumborSettings).
Scale modes
| Plone mode | Thumbor behaviour |
|---|---|
scale (default) |
fit-in + smart crop — fits within box, no upscale |
cover |
Smart crop to exact dimensions |
contain |
fit-in only — fits within box, no crop |
Try It Out
A self-contained Docker Compose stack (Plone 6.2 + Thumbor + PostgreSQL + nginx) using PyPI releases is in tryout/.
cd tryout
docker compose up -d --build
# Plone at http://localhost:8080 (admin/admin)
For development with local source installs, use development/ instead.
Documentation
Rendered documentation: https://bluedynamics.github.io/plone-pgthumbor/
- Architecture -- request flow, Thumbor integration design
- Security -- three-layer access control model
- Configuration Reference -- all settings for Plone and Thumbor
- CHANGES.md -- changelog
Source Code and Contributions
The source code is managed in a Git repository, with its main branches hosted on GitHub. Issues can be reported there too.
We'd be happy to see many forks and pull requests to make this package even better. We welcome AI-assisted contributions, but expect every contributor to fully understand and be able to explain the code they submit. Please don't send bulk auto-generated pull requests.
Maintainers are Jens Klein and the BlueDynamics Alliance developer team. We appreciate any contribution and if a release on PyPI is needed, please just contact one of us. We also offer commercial support if any training, coaching, integration or adaptations are needed.
License
GPL-2.0
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plone_pgthumbor-0.3.0.tar.gz.
File metadata
- Download URL: plone_pgthumbor-0.3.0.tar.gz
- Upload date:
- Size: 72.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cca5265e9267c87dec97e2cb652271760143e701d73fd9e545ffc87e0c892dd
|
|
| MD5 |
2b9f66fd06ceddf23d2fcc5136e7512a
|
|
| BLAKE2b-256 |
d36b322f2bf234dde5cbf189a2da08f294b8d39fde3d4f1280a4fd7776d2f44a
|
Provenance
The following attestation bundles were made for plone_pgthumbor-0.3.0.tar.gz:
Publisher:
release.yaml on bluedynamics/plone-pgthumbor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plone_pgthumbor-0.3.0.tar.gz -
Subject digest:
2cca5265e9267c87dec97e2cb652271760143e701d73fd9e545ffc87e0c892dd - Sigstore transparency entry: 1069611203
- Sigstore integration time:
-
Permalink:
bluedynamics/plone-pgthumbor@d9febbf90d78334c5bc70c9ab0f481b353962e33 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/bluedynamics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@d9febbf90d78334c5bc70c9ab0f481b353962e33 -
Trigger Event:
release
-
Statement type:
File details
Details for the file plone_pgthumbor-0.3.0-py3-none-any.whl.
File metadata
- Download URL: plone_pgthumbor-0.3.0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53573e9d826601a8f336fc1a1c9ed0306d3a058c1f45c77be95faf400cd63df7
|
|
| MD5 |
2fb6b20685bd4e1b9e40c41c899e6221
|
|
| BLAKE2b-256 |
43904385cbb7d68f071883984db8427f865335dcdedce68fc22ee0c68e8de0f0
|
Provenance
The following attestation bundles were made for plone_pgthumbor-0.3.0-py3-none-any.whl:
Publisher:
release.yaml on bluedynamics/plone-pgthumbor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plone_pgthumbor-0.3.0-py3-none-any.whl -
Subject digest:
53573e9d826601a8f336fc1a1c9ed0306d3a058c1f45c77be95faf400cd63df7 - Sigstore transparency entry: 1069611250
- Sigstore integration time:
-
Permalink:
bluedynamics/plone-pgthumbor@d9febbf90d78334c5bc70c9ab0f481b353962e33 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/bluedynamics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@d9febbf90d78334c5bc70c9ab0f481b353962e33 -
Trigger Event:
release
-
Statement type: