Created
August 17, 2011 20:53
-
-
Save frankwiles/1152592 to your computer and use it in GitHub Desktop.
Imagekit use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In imagekit_specs.py | |
from imagekit.specs import ImageSpec | |
from imagekit import processors | |
class EnhanceAvatar(processors.Adjustment): | |
contrast = 1.2 | |
sharpness = 1.1 | |
class ResizeAvatar(processors.Resize): | |
width = 100 | |
height = 100 | |
crop = True | |
class Avatar(ImageSpec): | |
access_as = 'avatar' | |
pre_cache = True | |
quality = 100 | |
processors = [ResizeAvatar, EnhanceAvatar] | |
# In models | |
class Member(ImageModel): | |
picture = models.ImageField() | |
class IKOptions: | |
spec_module = 'imagekit_specs' | |
image_field = 'picture' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment