Configuration reference#
This page documents all configuration options for the Thumbor image scaling
integration.
Settings are split between the Plone side (plone.pgthumbor)
and the Thumbor side (zodb-pgjsonb-thumborblobloader).
Plone-side settings (plone.pgthumbor)#
Environment variables#
Environment variables take precedence over Plone registry settings. When an environment variable is set, the corresponding registry value is ignored.
Variable |
Type |
Default |
Description |
|---|---|---|---|
|
string |
(none) |
Public URL of the Thumbor server (for example, |
|
string |
|
Shared HMAC-SHA1 key for signing Thumbor URLs. Must match the |
|
boolean |
|
Generate unsigned |
|
integer |
|
Longest edge in pixels for the Thumbor source derivative. |
If neither PGTHUMBOR_SECURITY_KEY nor PGTHUMBOR_UNSAFE is set,
Thumbor URL generation is disabled and Plone falls back to standard
ZODB-based image scaling.
Plone registry (IThumborSettings)#
These settings are editable through the Plone control panel
(@@thumbor-settings) and stored in plone.app.registry. Environment
variables override these values when set.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
Bool |
|
Enable Thumbor smart cropping (OpenCV face/feature detection). Applied to |
|
Bool |
|
Always verify image access with Plone for every request, even for publicly accessible content. When disabled, only non-public images use the authenticated 3-segment URL format. |
|
Int |
|
Longest edge in pixels for the Thumbor source derivative. Constrained to the range |
server_url, security_key and unsafe are not registry fields.
They are configured through environment variables only, and the records were removed by the profile upgrade to version 3.
Choosing a source derivative cap#
The default of 4000 is a safe starting point for a site nobody has measured.
It is not a recommendation for your site.
The cap trades storage against how far an editor can crop before the result softens.
A crop covering fraction X of the derivative’s edge feeds cap * X source pixels into a rendition of width S, so it stays lossless while X >= S / cap.
The binding S is not your largest registered scale.
It is the largest scale that actually carries a crop, because crops are stored per scale name.
Largest cropped scale |
cap 4000 |
cap 5000 |
|---|---|---|
1600 |
40 % |
32 % |
460 |
11.5 % |
9.2 % |
400 |
10 % |
8 % |
175 |
4.4 % |
3.5 % |
A site that only crops a 400 pixel preview therefore has a threshold of 10 % at the default cap, not 40 %.
Raising the cap to 5000 costs roughly 1.56 times the storage and resize memory per derivative.
The 8000 ceiling is not a matter of taste.
A longest edge of E bounds the derivative at E² pixels, and Thumbor refuses to process anything above its MAX_PIXELS limit of 75 megapixels.
Above sqrt(75e6), roughly 8660, a derivative could reproduce the very HTTP 400 the feature exists to remove.
It would do so silently, because generation would succeed and only Thumbor would object.
Values above the ceiling are clamped on read, including values already stored in the registry before the bound existed.
Changing the cap is a setting change rather than a migration. The cap in force is recorded alongside each derivative, so an ordinary backfill run picks up everything generated under a different value.
Crop providers (ICropProvider)#
plone.pgthumbor uses a pluggable ICropProvider adapter to look up
explicit crop coordinates before generating Thumbor URLs.
See Write a custom crop provider for details on writing a custom
provider.
Built-in providers:
Provider |
Package |
Registration |
|---|---|---|
|
|
Automatic via conditional ZCML (registered when |
Interface: plone.pgthumbor.interfaces.ICropProvider
Method |
Parameters |
Returns |
|---|---|---|
|
|
|
When a crop provider returns coordinates, the generated Thumbor URL
includes crop instructions and forces fit_in=True, smart=False.
When no provider is registered or the provider returns None, URL
generation proceeds based on the scale mode and smart cropping settings.
Thumbor-side settings (zodb-pgjsonb-thumborblobloader)#
All Thumbor-side settings are configured in thumbor.conf.
Loader and handler registration#
Key |
Value |
Description |
|---|---|---|
|
|
Registers the blob loader that reads images from the |
|
|
Registers the auth handler that enforces Plone access control for 3-segment URLs. |
Security#
Key |
Type |
Default |
Description |
|---|---|---|---|
|
string |
(none) |
Thumbor’s HMAC-SHA1 signing key. Must match |
|
boolean |
|
Accept unsigned |
PostgreSQL connection#
Key |
Type |
Default |
Description |
|---|---|---|---|
|
string |
(required) |
PostgreSQL connection string (for example, |
|
integer |
|
Minimum number of connections in the async connection pool. |
|
integer |
|
Maximum number of connections in the async connection pool. |
The loader uses psycopg with AsyncConnectionPool.
On first use, it
verifies that the blob_state table exists (created by zodb-pgjsonb).
Disk cache#
Key |
Type |
Default |
Description |
|---|---|---|---|
|
string |
|
Directory for the local blob cache. Empty string disables caching. |
|
integer |
|
Maximum cache size in bytes. |
Cache filenames are deterministic: {zoid:016x}-{tid:016x}.blob.
Since
blobs are addressed by immutable (zoid, tid) pairs, there is no cache
invalidation concern – only LRU eviction for space management.
S3 storage (optional)#
When blob data is stored in S3 (instead of or in addition to PG bytea),
the loader falls back to S3 if the data column is NULL and s3_key
is present.
Key |
Type |
Default |
Description |
|---|---|---|---|
|
string |
|
S3 bucket name. Required when blobs use S3 tiering. |
|
string |
|
AWS region for the S3 bucket. |
|
string |
|
Custom S3 endpoint URL (for MinIO or compatible services). Empty uses the default AWS endpoint. |
S3 downloads use boto3 synchronously, wrapped in asyncio.to_thread
for compatibility with Thumbor’s async event loop.
Plone auth handler#
Key |
Type |
Default |
Description |
|---|---|---|---|
|
string |
|
Internal URL of the Plone site (for example, |
|
integer |
|
Auth result cache lifetime in seconds. Cached per |
Automatic image format conversion#
Key |
Type |
Default |
Description |
|---|---|---|---|
|
boolean |
|
Automatically convert images to WebP when the browser’s |
|
boolean |
|
Automatically convert images to AVIF when the browser’s |
These are standard Thumbor settings. When enabled, format conversion is transparent – the same signed URL serves different formats based on content negotiation.
Smart cropping (detectors)#
Key |
Type |
Default |
Description |
|---|---|---|---|
|
list of strings |
|
Thumbor detector modules for |
Detectors run in-process when a URL contains /smart/.
Face detection is tried first; feature detection is used as fallback.
On the Plone side, enable smart_cropping in the registry so URLs include /smart/.
Result storage (optional)#
Thumbor’s built-in result storage caches the final processed images. This is separate from the blob disk cache (which caches raw originals).
Key |
Type |
Default |
Description |
|---|---|---|---|
|
string |
(none) |
Result storage backend, for example, |
|
string |
(none) |
Directory for file-based result storage. |