Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > HTTP (WWW)

    django-thumbs 0.4

    Download button

    No screenshots available
    Downloads: 130  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Antonio Mele | More programs
    BSD License / FREE
    April 28th, 2012, 10:59 GMT
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    django-thumbs description

    The easiest way to create thumbnails for your images with Django

    django-thumbs is a Django app that offers the easiest way to create thumbnails for your images with Django. Works with any StorageBackend.

    Getting It

    You can get Django-Thumbs by using pip or easy_install:

     pip install django-thumbs

    or

     easy_install django-thumbs

    If you want to install it from source, grab the git repository from github and run setup.py:

     git clone git://github.com/skitoo/django-thumbs.git
     cd django-thumbs
     python setup.py install


    Installation

    - Import it in your models.py and replace ImageField with ImageWithThumbsField in your model
    - Add a sizes attribute with a list of sizes you want to use for the thumbnails
    - Make sure your have defined MEDIA_URL in your settings.py
    - That's it!

    Working example

    from django.db import models
    from django_thumbs.db.models import ImageWithThumbsField

    class Person(models.Model):
     photo = ImageWithThumbsField(upload_to='images', sizes=((125,125),(200,200)))
     second_photo = ImageWithThumbsField(upload_to='images')


    In this example we have a Person model with 2 image fields.

    You can see the field second_photo doesn't have a sizes attribute. This field works exactly the same way as a normal ImageField.

    The field photo has a sizes attribute specifying desired sizes for the thumbnails. This field works the same way as ImageField but it also creates the desired thumbnails when uploading a new file and deletes the thumbnails when deleting the file.

    With ImageField you retrieve the URL for the image with: someone.photo.url With ImageWithThumbsField you retrieve it the same way. You also retrieve the URL for every thumbnail specifying its size: In this example we use someone.photo.url_125x125 and someone.photo.url_200x200 to get the URL of both thumbnails.

    Uninstall

    At any time you can go back and use ImageField again without altering the database or anything else. Just replace ImageWithThumbsField with ImageField again and make sure you delete the sizes attribute. Everything will work the same way it worked before using django-thumbs. Just remember to delete generated thumbnails in the case you don't want to have them anymore.


    Product's homepage

    Here are some key features of "django-thumbs":

    · Easy to integrate in your code (no database changes, works as an ImageField)
    · Works perfectly with any StorageBackend
    · Generates thumbnails after image is uploaded into memory
    · Deletes thumbnails when the image file is deleted
    · Provides easy access to the thumbnails' URLs (similar method as with ImageField)

    Requirements:

    · Python
    · Django
    · PIL

      


    TAGS:

    image thumbnails | Django thumbs | Django | image | thumbnails

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM