When set to True the ThumbnailNode.render method can raise errors. Django recommends that tags never raise errors in the Node.render method but since sorl-thumbnail is such a complex tag we will need to have more debugging available.
This is the entry point for generating thumbnails, you probably want to keep the default one but just in case you would like to generate thumbnails filenames differently or need some special functionality you can override this and use your own implementation.
sorl-thumbnail needs a Key Value Store to How sorl-thumbnail operates. sorl-thumbnail ships with support for two Key Value Stores:
sorl.thumbnail.kvstores.cached_db_kvstore.KVStore. This is the default and preferred Key Value Store.
sorl.thumbnail.kvstores.redis_kvstore.KVStore. It requires you to install a Redis server as well as a redis python client.
Since MSSQL reserved the key name for db columns you can change this to something else using this setting.
This is the processing class for sorl-thumbnail. It does all the resizing, cropping or whatever processing you want to perform. sorl-thumbnail ships with three engines:
'sorl.thumbnail.engines.pil_engine.Engine'. This is the default engine because it is what most people have installed already. Features:
'sorl.thumbnail.engines.pgmagick_engine.Engine'. Pgmagick uses Graphics. Fatures:
'sorl.thumbnail.engines.convert_engine.Engine'. This engine uses the ImageMagick convert or GraphicsMagic gm convert command. Features:
Path to convert command, use 'gm convert' for GraphicsMagick. Only applicable for the convert Engine.
Path to identify command, use 'gm identify' for GraphicsMagick. Only applicable for the convert Engine.
The storage class to use for the generated thumbnails.
The password for Redis server. Only applicable for the Redis Key Value Store
The host for Redis server. Only applicable for the Redis Key Value Store
The port for Redis server. Only applicable for the Redis Key Value Store
Cache timeout for Cached DB Key Value Store. You should probably keep this at maximum or None if your caching backend can handle that as infinite. Only applicable for the Cached DB Key Value Store.
Default image format, supported formats are: 'JPEG', 'PNG'. This also implicitly sets the filename extension. This can be overridden by individual options.
Default thumbnail color space, engines are required to implement: 'RGB', 'GRAY' Setting this to None will keep the original color space. This can be overridden by individual options.
Should we upscale by default? True means we upscale images by default. False means we don’t. This can be overridden by individual options.
Default thumbnail quality. A value between 0 and 100 is allowed. This can be overridden by individual options.
Saves jpeg thumbnails as progressive jpegs. This can be overridden by individual options.
This is a very powerful option which came from real world frustration. The use case is when you want to do development on a deployed project that has image references in its database. Instead of downloading all the image files from the server hosting the deployed project and all its thumbnails we just set this option to True. This will generate placeholder images for all thumbnails missing input source.
This is the generated thumbnail whensource of the presented thumbnail. Width and Height is passed to the string for formatting. Other options are for example:
This value sets an image ratio to all thumbnails that are not defined by width and height since we cannot determine from the file input (since we don’t have that).