StdImageField: Improved image field for Django

You can connect with me on LinkedIn to discuss collaborations and work opportunities.

You can also follow me on Twitter, Bluesky and Mastodon.

I'm pleased to announce a new project, django-stdimage, that provides a new image field with many improvements respect to Django's core ImageField.

Features of StdImageField:
-

  • Saved files have standardized names (using field name and object id)

  • Images can be removed

  • Automatically creates a thumbnail

  • Automatically resizes both image and thumbnail (with optional crop to fit exactly specified size)


  • Here you've an example of usage:


    from django.db import models
    from stdimage import StdImageField


    class MyClass(models.Model):
      my_image = StdImageField(upload_to='path/to/img', blank=True, \
        size=(640, 480), thumbnail_size=(100, 100, True))


    If a file called "uploaded_file.png" is uploaded for object id 34, then result will be:
    -
  • /path/to/img/my_image_34.png (with bigger possible size to fit in a 640x480 area)

  • /path/to/img/my_image_34.thumbnail.png (with a exact size of 100x100, cropping if necessary)


  • Also it will appear a check-box for deleting when using admin.

    You can connect with me on LinkedIn to discuss collaborations and work opportunities.

    You can also follow me on Twitter, Bluesky and Mastodon.