Thumbnails

Thumbnailer module

For easy display of thumbnails we provide a template tag that takes a list of thumbs and displays them. The actual display of the thumbnail is done by providing different templates for different media types and a template for non-existing media.

Thumbnail generation is from third party system, and its also responsible to serve the thumbnails, however our thumbnail generator does make the references, cache those references, and build the tags and views for supporting the thumbnails.

Settings

Simply have the following in portal.conf:

[thumbnails]
THUMBNAIL_WIDTH: 242
THUMBNAIL_HEIGHT: 136
THUMBNAIL_MOUSE_SCRUB: True

If THUMBNAIL_MOUSE_SCRUB is set to False then the scrubbing won’t happen on any template.

Usage

Item should be a context, that holds a thumbnail key. It will look in the value for a dictionary of results:

{% load thumbnailer %}
{% create_thumbnails item item_URL %}

The generation of the thumbnails is cached for each media item speeding up subsequent requests if the caching framework is enabled.

The item_URL should be the link for the full version of the item.

No Thumbnails

No thumbnails are handled by displaying a template media/media_no_thumbnail.html

It has the following context information:

  • item

  • height

  • width

The HTML has a div with class .nothumbnail and in the supplied template the height and width are set from the context information which is gathered from the settings.