kotti.views.image

Views for image content objects.

kotti.views.image.image_scales = {'span1': [60, 120], 'span10': [960, 1920], 'span11': [1060, 2120], 'span12': [1160, 2320], 'span2': [160, 320], 'span3': [260, 520], 'span4': [360, 720], 'span5': [460, 920], 'span6': [560, 1120], 'span7': [660, 1320], 'span8': [760, 1520], 'span9': [860, 1720]}

Default image scales

class kotti.views.image.ImageView(context, request)[source]

Bases: object

The ImageView class is registered for the IImage context.

view()[source]
Result:Empty dictionary to be handed to the image.pt template for rendering.
Return type:dict
image(subpath=None)[source]

Return the image in a specific scale, either inline (default) or as attachment.

Parameters:subpath (str) – [<image_scale>]/download] (optional). When ‘download’ is the last element in subpath, the image is served with a ‘Content-Disposition: attachment’ header. <image_scale> has to be one of the predefined image_scales - either from the defaults in this module or one set with a kotti.image_scales.<scale_name> in your app config ini file.
Result:complete response object
Return type:pyramid.response.Response