Created
February 10, 2011 03:50
-
-
Save bryanveloso/819905 to your computer and use it in GitHub Desktop.
An example of django-imagekit's specfile.
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
class Shot(ImageModel): | |
photo = models.ImageField(upload_to='photos/groups/') | |
taken = models.DateField() | |
class IKOptions: | |
image_field = 'photo' | |
spec_module = 'specs' |
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
from imagekit.specs import ImageSpec | |
from imagekit import processors | |
class Enhance(processors.Adjustment): | |
contrast = 1.1 | |
sharpness = 1.1 | |
class ResizeDisplay(processors.Resize): | |
height = 296 | |
class ResizeMini(processors.Resize): | |
crop = True | |
height = 30 | |
width = 30 | |
class ResizeThumb(processors.Resize): | |
width = 72 | |
class ResizeRanking(processors.Resize): | |
width = 230 | |
class Display(ImageSpec): | |
pre_cache = True | |
processors = [Enhance, ResizeDisplay] | |
quality = 80 | |
class Mini(ImageSpec): | |
pre_cache = True | |
processors = [Enhance, ResizeMini] | |
quality = 80 | |
class Ranking(ImageSpec): | |
pre_cache = True | |
processors = [Enhance, ResizeRanking] | |
quality = 80 | |
class Thumbnail(ImageSpec): | |
pre_cache = True | |
processors = [Enhance, ResizeThumb] | |
quality = 80 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🆒 🔥 👍