Commits

Greg Newman committed eda3439

moving some of the image specs to the settings for easy changing of how images are processed

  • Participants
  • Parent commits 58baa8c

Comments (0)

Files changed (2)

example/settings.py

 )
 
 
+# Loupe Settings for images
+LOUPE_RESIZE_THUMB_WIDTH = 100 # Width in pixels of the thumbnail
+LOUPE_RESIZE_THUMB_HEIGHT  = 75 # Height in pixels of the thumbnail
+LOUPE_RESIZE_THUMB_CROP = True # Crop thubmnails? True or False
+LOUPE_RESIZE_DISPLAY_WIDTH = 800 # Width in pixels of the display size (not full size image)
+LOUPE_PRE_CACHE_IMAGES = True # Pre-cache images on upload? True or False
+
 try:
    from local_settings import *
 except ImportError:
 from imagekit.specs import ImageSpec 
-from imagekit import processors 
+from imagekit import processors
+
+from django.conf import settings
 
 # thumbnail resize processor 
 class ResizeThumb(processors.Resize): 
-    width = 100 
-    height = 75 
-    crop = True
+    width = settings.LOUPE_RESIZE_THUMB_WIDTH
+    height = settings.LOUPE_RESIZE_THUMB_HEIGHT 
+    crop = settings.LOUPE_RESIZE_THUMB_CROP
 
 # display size resize processor
 class ResizeDisplay(processors.Resize):
-    width = 800 
+    width = settings.LOUPE_RESIZE_DISPLAY_WIDTH
 
 # adjustment processor to enhance the image at small sizes 
 class EnchanceThumb(processors.Adjustment): 
 # define our thumbnail spec 
 class Thumbnail(ImageSpec): 
     access_as = 'thumbnail_image' 
-    pre_cache = True 
+    pre_cache = settings.LOUPE_PRE_CACHE_IMAGES 
     processors = [ResizeThumb, EnchanceThumb] 
 
 # and our display spec