Coder Social home page Coder Social logo

cotcac / django_advance_thumbnail Goto Github PK

View Code? Open in Web Editor NEW

This project forked from itsmahadi007/django_advance_thumbnail

0.0 0.0 0.0 18 KB

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.

License: MIT License

Python 100.00%

django_advance_thumbnail's Introduction

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

  1. Install the package using pip:
pip install django_advance_thumbnail
  1. Add django_advance_thumbnail to your INSTALLED_APPS in settings.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:

Credits

This package was created by Mahadi Hassan. Special thanks to the Django and Python communities for their invaluable resources and support.

django_advance_thumbnail's People

Contributors

itsmahadi007 avatar cotcac avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.