A Django app that automates thumbnail creation for image fields.
Project description
Django Advance Thumbnail
Django Advance Thumbnail is a Django app that automates thumbnail creation for image fields. It generates, updates, and deletes thumbnails based on the source image, and allows custom thumbnail sizes.
Installation
- Install the package using pip:
pip install django_advance_thumbnail
- Add
django_advance_thumbnail
to yourINSTALLED_APPS
insettings.py
:
INSTALLED_APPS = [
# ...
'django_advance_thumbnail',
# ...
]
Usage
Here's a basic example of how to use the AdvanceDJThumbnailField
in a model:
from django.db import models
from django_advance_thumbnail import AdvanceThumbnailField
class MyModel(models.Model):
image = models.ImageField(upload_to='images/', null=True, blank=True)
thumbnail = AdvanceThumbnailField(source_field='image', upload_to='thumbnails/', null=True, blank=True,
size=(300, 300))
In this example, AdvanceDJThumbnailField
is used to create a thumbnail
from the image
field. Whenever an image is
uploaded or updated, a corresponding thumbnail is automatically generated and stored in the thumbnail
field. The
thumbnail's dimensions are determined by the optional size
parameter, which defaults to (300, 300)
if not specified.
This setup ensures that the lifecycle of the thumbnail is tied to its source image. If the source image is deleted, the associated thumbnail is also removed. This seamless synchronization simplifies image management in your Django models.
Contact
For any questions or feedback, feel free to reach out:
- Email: mh@mahadihassan.com, me.mahadi10@gmail.com
- Github: @itsmahadi007
- Linkedin: Mahadi Hassan
- Web: mahadihassan.com
Credits
This package was created by Mahadi Hassan. Special thanks to the Django and Python communities for their invaluable resources and support.
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
File details
Details for the file django_advance_thumbnail-1.0.2.tar.gz
.
File metadata
- Download URL: django_advance_thumbnail-1.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69b4d5dc1ae6f8afcad6c872ebfff562159a378a19f28d56f90aa2618d039bbf |
|
MD5 | 1d1b2c5ef66058de2f1358f76060421a |
|
BLAKE2b-256 | 87195faaf5136f4cd047ded5af092d91b50c659bf6bc370e534a66ca14c31686 |