Skip to content
patrickomatic edited this page Sep 14, 2010 · 22 revisions

Quick Install

  1. Add urlimaging to your INSTALLED_APPS in settings.py like:
    
    INSTALLED_APPS = (
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'urlimaging',
    ) 
    
  2. Add an entry to urls.py so that django-url-imaging can listen for image processing commands. Something along the lines of:

    urlpatterns = patterns('', ... (r'^images/', include('urlimaging.urls')), ... )
  3. Configure image storage options for either local storage or storage on Amazon S3.

Configuring local image storage

If you are planning to serve and store images using the local filesystem, you must set the following properties in settings.py:

  • IMAGE_STORAGE_DIR – The directory where processed images will be stored. Defaults to settings.MEDIA_ROOT

Configuring image storage on Amazon S3

When using django-url-imaging with the Amazon S3 service, you must set the following properties in settings.py

  • S3_BUCKET_NAME – The name of the bucket (which should already be created) on S3 where images will be stored.
  • S3_EXPIRES(optional) – The length of time which the S3-generated URL will be valid.
  • AWS_ACCESS_KEY_ID – The AWS access key provided by Amazon.
  • AWS_SECRET_ACCESS_KEY – The AWS secret access key provided by Amazon.

Other configuration

You may also set the following properties in settings.py

  • WHITELIST_FN – Defines a function which takes one argument – the URL of the current image processing request. The method should return True or False to either allow the image to be processed or not. If not set it will only allow images to be processed from URLs containing settings.MEDIA_URL
  • IMAGE_STORAGE_DIRECTORY – The directory where temporary image files will be created. Defaults to /tmp
Clone this wiki locally