Jump to >

djblets.util.templatetags.djblets_images

save_image_to_storage(image, storage, filename)[source]

Save an image to storage.

crop_image(f, x, y, width, height)[source]

Crops an image at the specified coordinates and dimensions, returning the resulting URL of the cropped image.

thumbnail(f, size=u‘400x100’)[source]

Create a thumbnail of the given image.

This will create a thumbnail of the given file (a Django FileField or ImageField) with the given size. Size can either be a string of WxH (in pixels), or a 2-tuple. If the size is a tuple and the second part is None, it will be calculated to preserve the aspect ratio.

This will return the URL to the stored thumbnail.