Skip to main content

Adds CropperJS's functionality to image fields in Django/Django CMS admin.

Project description

Adds CropperJS’s functionality to image fields in Django/Django CMS admin, including inlines.

CropperImageField is a subclass from ImageField, and so can be interchanged in your existing base without data loss.

Quick start

  • Add “cropperjs” to your INSTALLED_APPS setting like this:

INSTALLED_APPS = [
    ...
    'cropperjs',
]
  • Change/set your model’s image field to use CropperImageField instead of ImageField.

from cropperjs.models import CropperImageField

image_field = CropperImageField(...)

Field options

All options from ImageField are (or should be) usable, like upload_to. These below allow you to customize some of the CropperJS component behavior on a field-to-field basis:

aspectratio: float

Suggests (as in, can be overriden later at client-side if needed) a fixed proportion for the Cropper component, e.g. 1.7777 (16:9).

dimensions: tuple(int, int)

Defines a fixed dimension for the image generated. When informed, calculates and overrides aspectratio.

linked: bool

Linked Cropper fields are called consecutively after any other in the same context (outside inlines, inline groups) is saved, using the same original image specified by the user. Useful when the user needs the same image but in different ways/sizes, e.g. a main image and a 1:1 thumbnail.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-cropperjs2-0.0.7.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_cropperjs2-0.0.7-py3-none-any.whl (66.1 kB view details)

Uploaded Python 3

File details

Details for the file django-cropperjs2-0.0.7.tar.gz.

File metadata

  • Download URL: django-cropperjs2-0.0.7.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for django-cropperjs2-0.0.7.tar.gz
Algorithm Hash digest
SHA256 4ca97aa15b48efae409523f4debbefdabc9f8bbbef6587588688614b3597c231
MD5 20054724bde05edeb11f703f3d3f053d
BLAKE2b-256 6ed2f9473539962127caf6b93d95d8422d422e7f65bb7ace00e6fd1a9d4abdf6

See more details on using hashes here.

File details

Details for the file django_cropperjs2-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for django_cropperjs2-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 959f01788b62859e5dc8392cca4300df864fe115474fbb50dbb23f90be2a7525
MD5 672d8b6cf8ec3c44cee54e5a9c79f525
BLAKE2b-256 e676655c5652b3192999343960787a59f784ba34a9f31481026c56266c27df44

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page