Thumbnail module¶
- class ultimatethumb.thumbnail.ThumbnailSet(source, sizes, options)[source]¶
Bases:
object
A ThumbnailSet holds the source configuration and a number of thumbnails as requested.
- __init__(source, sizes, options)[source]¶
Takes a valid source and a list of requested sizes together with additional options.
- class ultimatethumb.thumbnail.Thumbnail(source, opts)[source]¶
Bases:
object
This object represents a single thumbnail.
- __init__(source, opts)[source]¶
Given a source and options, this method initializes the Thumbnail object. Some validation on the provided options are done.
- classmethod from_name(name)[source]¶
Using a name, reconstruct a thumbnail object. The name is actually a cache key which is used by get_thumb_data to fetch the original thumbnail configuration.
- size[source]¶
The size property returns the calculated, estimated thumbnail size without actually generating the thumbnail image.
- viewport[source]¶
Returns the valid viewport for this thumbnail, might be used in templates to configure the source sets properly.
- property base64[source]¶
Returns the base64 representation of the thumbnail to use in a src attribute.
- get_storage_url(factor=1)[source]¶
Returns the real url to use in the ultimatethumb view for returning the image.
- get_storage_path(factor=1, generate=True)[source]¶
Returns the storage path in filesystem of the thumbnail file.
- get_estimated_size()[source]¶
Calculates the estimated thumbnail image dimensions based on the source size and the options provided.
- get_storage_name(factor=1, suffix=None)[source]¶
Returns the name to use when storing the thumbnail to disk.
- generate(factor=1)[source]¶
Genrate the thumbnail using Graphicsmagick and Pngquant (if enabled and source image is a png file.
- get_gm_options(factor=1)[source]¶
Generates the option set dor Graphicsmagick to generate the thumbnail.
- get_base64_content()[source]¶
Reads the base64 version of the thumbnail from disk and returns content.