@@ -39,17 +39,54 @@ Installation
3939
4040 pip install django-image-cropping
4141
42- #. Install your backend of choice.
42+ #. Configure the backend of your choice. By default the `easy-thumbnails `-backend is used which requires `easy-thumbnails ` to also be installed.
43+
44+
45+ Configuration
46+ =============
47+
48+ Add an ``ImageRatioField `` to the model that contains the ``ImageField `` for the images you want to crop.
49+
50+ The ``ImageRatioField `` simply stores the boundaries of the cropped image.
51+ It expects the name of the associated ``ImageField `` and the desired size of the cropped image as arguments.
52+
53+ The size is passed in as a string and defines the aspect ratio of the selection *as well * as the minimum
54+ size for the final image::
55+
56+ from django.db import models
57+ from image_cropping import ImageRatioField
58+
59+ class MyModel(models.Model):
60+ image = models.ImageField(blank=True, upload_to='uploaded_images')
61+ # size is "width x height"
62+ cropping = ImageRatioField('image', '430x360')
63+
64+ You can configure a `size warning `_ if users try to crop a selection smaller than the defined minimum.
65+
66+ Admin Integration
67+ =================
68+
69+ Add the ``ImageCroppingMixin `` to your ``ModelAdmin ``::
70+
71+ from django.contrib import admin
72+ from image_cropping import ImageCroppingMixin
73+
74+ class MyModelAdmin(ImageCroppingMixin, admin.ModelAdmin):
75+ pass
76+
77+ admin.site.register(MyModel, MyModelAdmin)
78+
79+ If your setup is correct you should now see the enhanced image widget that provides a selection
80+ area.
4381
4482
4583Backends
4684========
4785
4886django-image-cropping delegates the cropped image generation to a backend.
4987
50- There are two built-in backends, but can register any custom class
51- as a backend by overriding the default settings. The ``IMAGE_CROPPING_BACKEND ``
52- setting expects a dotted path to a class that implements the required methods.
88+ There are two built-in backends, but it is possible to provide custom backends.
89+ The ``IMAGE_CROPPING_BACKEND `` setting expects a dotted path to a class that implements the required methods.
5390
5491You can provide an optional dict that will be used to populate the backend's
5592constructor params.
@@ -124,44 +161,6 @@ package.
124161 'filebrowser.utils.scale_and_crop',
125162 )
126163
127-
128- Configuration
129- =============
130-
131- Add an ``ImageRatioField `` to the model that contains the ``ImageField `` for the images you want to crop.
132-
133- The ``ImageRatioField `` simply stores the boundaries of the cropped image.
134- It expects the name of the associated ``ImageField `` and the desired size of the cropped image as arguments.
135-
136- The size is passed in as a string and defines the aspect ratio of the selection *as well * as the minimum
137- size for the final image::
138-
139- from django.db import models
140- from image_cropping import ImageRatioField
141-
142- class MyModel(models.Model):
143- image = models.ImageField(blank=True, upload_to='uploaded_images')
144- # size is "width x height"
145- cropping = ImageRatioField('image', '430x360')
146-
147- You can configure a `size warning `_ if users try to crop a selection smaller than the defined minimum.
148-
149- Admin Integration
150- =================
151-
152- Add the ``ImageCroppingMixin `` to your ``ModelAdmin ``::
153-
154- from django.contrib import admin
155- from image_cropping import ImageCroppingMixin
156-
157- class MyModelAdmin(ImageCroppingMixin, admin.ModelAdmin):
158- pass
159-
160- admin.site.register(MyModel, MyModelAdmin)
161-
162- If your setup is correct you should now see the enhanced image widget that provides a selection
163- area.
164-
165164Frontend
166165========
167166
0 commit comments