ImageFile is an image abstraction that contains useful attributes when working with images. The thumbnail template tag puts the generated thumbnail in context as an ImageFile instance. In the following example:
{% thumbnail item.image "100x100" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}
im will be an ImageFile instance.
Name of the image as returned from the underlaying storage.
Returns the storage instance.
Returns the width of the image in pixels.
Alias of width
Returns the height of the image in pixels.
Alias of width
Returns the image ratio (y/x) as a float
URL of the image url as returned by the underlaying storage.
Alias of url
Returns the image size in pixels as a (x, y) tuple
Returns a unique key based on name and storage.
Returns whether the file exists as returned by the underlaying storage.
Returns True if y > x, else False
Sets the size of the image, takes an optional size tuple (x, y) as argument.
Reads the file as done from the underlaying storage.
Writes content to the file. Takes content as argument. Content is either raw data or an instance of django.core.files.base.ContentFile.
Deletes the file from underlaying storage.
Returns a serialized version of self.
Returns the self.storage as a serialized dot name path string.