Skip to main content
Django Image Helper

Provides a model mixin that has 'image' and 'thumbnail' fields.
The uploaded image will be scaled to the model's 'IMAGE_SIZE' and
a thumbnail will be scaled and saved to the model's 'THUMBNAIL_SIZE'.

Additionally, there is an admin mixin to help you display an image's thumbnail
when in the admin's listview.

RELEASE NOTES:

version 0.1.1
-------------
Added AdminImagePreviewWidget. This will show a preview of the image in the
admin change_form view in addition to the link the admin already shows.

To enable, add the following to your ModelAdmin. ::

formfield_overrides = {
SizedImageField: {'widget': AdminImagePreviewWidget},
}

version 0.1.0
-------------
Added SizedImageField. This lets you do the same thing the ``ImageMixin``
was used for, but isolates all the work to the model's field. It should
work with any storage backend.

See the example project for a working sample. The basics:

class MyModel(models.Model):
image = fields.SizedImageField(upload_to="the_directory", size=(500, 500), thumbnail_size=(200, 200))


Then you can access both the image and thumbnail in code or templates by:
model.image.url
model.image.thumbnail.url


Download files

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

Source Distribution

django-image-helper-0.4.0.tar.gz (7.2 kB view details)

Uploaded Source

File details

Details for the file django-image-helper-0.4.0.tar.gz.

File metadata

  • Download URL: django-image-helper-0.4.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for django-image-helper-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7040d77a4ac12522b0033a2a13b18d31a61930b6508ffeaaf59ee64311359686
MD5 49b4d35233e07e5d4e72c6e457f3371d
BLAKE2b-256 b7775aaa99e32bec183919191b1714492f48300daba1d83ae72718c3ecd60d28

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.0

1 file

This release

0.4.0 This release

1 file

0.3.0

1 file

0.2.1

1 file

0.2.0

1 file

0.1.1

1 file

0.1.0

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page