django-croppic
Croppic is a jquery plugin which handles uploading and manipulating images via AJAX.
A Django package which uses Croppic to upload and crop images.
Installation
Install from pypi:
pip install django-croppic
To use django-croppic
in your Django project:
- Add
croppic
to yourINSTALLED_APPS
setting. - Add
croppic.urls
in your mainurls
url(r'^croppic/', include('croppic.urls', namespace='croppic')),
- Run
syncdb
command to initialise thecroppic
database table - Run
collectstatic
command to collect the static files of croppic intoSTATIC_ROOT
(If on production)
Configuration
Available settings:
-
CROPPIC_UPLOAD_PATH
- Default:
pictures
- The default path where to store uploaded files.
- e.g.
CROPPIC_UPLOAD_PATH = 'user_photos'
(Notice no leading or trailing slashes).
- e.g.
- Default:
-
CROPPIC_MIN_SIZE
- Default:
None
(No restrictions) - Restrict uploaded/cropped files to have at least minimum width and height as defined by
CROPPIC_MIN_SIZE
.- e.g.
CROPPIC_MIN_SIZE = (250, 250)
- e.g.
- Default:
-
CROPPIC_MIN_SIZE_ERROR
- Default:
Image is too small, must be at least {0}x{1} wide.
(The{0}
and{1}
will be used in string formatting to replace with width and height) - If
CROPPIC_MIN_SIZE
is specified you may want to update this to show a different error message if uploaded/cropped image does not satisfyCROPPIC_MIN_SIZE
- Default: