Views module

class ultimatethumb.views.ThumbnailView(**kwargs)[source]

Bases: View

ThumbnailView is used to provide the thumbnails to the brower.

We don’t use a serve static view because we need to check if the requested thumbnail is available - and if not: generate one.

The view supports the X-Accel-Redirect header supported by Nginx to no really serve the binary (enabled by default if DEBUG is False).

get(*args, **kwargs)[source]

Fetch and return the thumbnail response.


Try to fetch the thumbnail based on the thumbnail name. Might fail if cache resets between generation of the thumbnail urls and fetching of the images.


Get factor from url.

render_thumbnail(thumbnail, factor)[source]

Generate the http response for the requested thumbnail. The code is able response with 304 if the thumbnail was already requested.

Supports X-Accel-Redirect, enabled by default if DEBUG is False.