You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-29Lines changed: 57 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,29 @@
4
4
5
5
# Django Standardized Image Field
6
6
7
-
Django Field that implement the following features:
7
+
## Why would I want this?
8
8
9
-
* Django-Storages compatible (S3)
10
-
* Resize images to different sizes
9
+
This is a drop-in replacement for the [Django ImageField](https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ImageField) that provides a standardized way to handle image uploads.
10
+
It is designed to be as easy to use as possible, and to provide a consistent interface for all image fields.
11
+
It allows images to be presented in various size variants (eg:thumbnails, mid, and hi-res versions)
12
+
and it provides a way to handle images that are too large with validators.
13
+
14
+
15
+
## Features
16
+
17
+
Django Standardized Image Field implements the following features:
18
+
19
+
*[Django-Storages](https://django-storages.readthedocs.io/en/latest/) compatible (eg: S3, Azure, Google Cloud Storage, etc)
20
+
* Resizes images to different sizes
11
21
* Access thumbnails on model level, no template tags required
12
-
* Preserves original image
13
-
*Asynchronous rendering (Celery & Co)
14
-
*Restrict accepted image dimensions
15
-
*Rename files to a standardized name (using a callable upload_to)
22
+
* Preserves original images
23
+
*Can be rendered asynchronously (ie as a [Celery job](https://realpython.com/asynchronous-tasks-with-django-and-celery/))
24
+
*Restricts acceptable image dimensions
25
+
*Renames file to a standardized name format (using a callable `upload_to` function, see below)
16
26
17
27
## Installation
18
28
19
-
Simply install the latest stable package using the command
29
+
Simply install the latest stable package using the following command
20
30
21
31
```bash
22
32
pip install django-stdimage
@@ -28,11 +38,13 @@ and add `'stdimage'` to `INSTALLED_APP`s in your settings.py, that's it!
28
38
29
39
## Usage
30
40
41
+
Now it's instally you can use either: `StdImageField` or `JPEGField`.
You can use a function for the `upload_to` argument. Using [Django Dynamic Filenames][dynamic_filenames].[dynamic_filenames]: https://github.com/codingjoe/django-dynamic-filenames
89
103
90
-
Since version 4 the custom `upload_to` utils have been dropped in favor of
91
-
[Django Dynamic Filenames][dynamic_filenames].
104
+
This allows images to be given unique paths and filenames based on the model instance.
0 commit comments