Django app to provide integration with IIPImage server.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Django app to provide integration with IIPImage server.

To use, add iipimage to INSTALLED_APPS and appropriate values for the following two variables in

  • IMAGE_SERVER_URL - the URL of the IIPImage server script
  • IMAGE_SERVER_ROOT - the path to where the images are to be stored

In the model definition, use something along the following lines:

import iipimage.fields

class Image (models.Model):

    image = iipimage.fields.ImageField(,

iipimage.fields.ImageField supports the height_field and width_field arguments, and has a thumbnail_url method that returns a URL for a thumbnail at the specified height and/or width.

For example, to provide a thumbnail suitable for use in Django's admin as well as elsewhere, the following method on the image's model should suffice:

from django.utils.safestring import mark_safe

class Image (models.Model):


    def thumbnail (self, height=100):
        """Displays a thumbnail-sized version of this image."""
        html = ''
            url = image.thumbnail_url(height=height)
            html = mark_safe('<img height="{}" src="{}">'.format(height, url))
        return html
    thumbnail.allow_tags = True
    thumbnail.short_description = 'Thumbnail'