Anonymous avatar Anonymous committed 4208d7c

Added crop choice tuples and tweaked a couple of comments

Comments (0)

Files changed (1)

imagekit/models.py

 # Modify image file buffer size.
 ImageFile.MAXBLOCK = getattr(settings, 'PIL_IMAGEFILE_MAXBLOCK', 256 * 2 ** 10)
 
+# Choice tuples for specifying the crop origin.
+# These are provided for convienience.
+CROP_HORZ_CHOICES = (
+    (0, _('left')),
+    (1, _('center')),
+    (2, _('right')),
+)
+
+CROP_VERT_CHOICES = (
+    (0, _('top')),
+    (1, _('center')),
+    (2, _('bottom')),
+)
+
 
 class ImageModelBase(ModelBase):
+    """ ImageModel metaclass
+    
+    This metaclass parses IKOptions and loads the specified specification
+    module.
+    
+    """
     def __init__(cls, name, bases, attrs):
         parents = [b for b in bases if isinstance(b, ImageModelBase)]
         if not parents:
 class ImageModel(models.Model):
     """ Abstract base class implementing all core ImageKit functionality
     
-    Subclasses of ImageModel can override the inner IKOptions class to customize
+    Subclasses of ImageModel are augmented with accessors for each defined
+    image specification and can override the inner IKOptions class to customize
     storage locations and other options.
     
     """
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.