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

Metadata

Release files for django-image-helper 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-image-helper 0.5.0
File Size Uploaded Provenance Actions
django-image-helper-0.5.0.tar.gz 7.4 kB Without provenance Details for django-image-helper-0.5.0.tar.gz

Release files / django-image-helper-0.5.0.tar.gz

Download URL django-image-helper-0.5.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d22d95f984e7ff5efe6c222fd48a9dafe18e265339ec710a3d7fe67c4ff7e64b
BLAKE2b-256 checksum
How to use checksums
73bf0a04918a11e62a9744b7c3529e5195365d98d963ae30fd4661a5e966daf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Security for django-image-helper 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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