Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6219683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:49:36+00:00 2026-05-24T07:49:36+00:00

I have a image field in the model. I need to make two copies(resized)

  • 0

I have a image field in the model. I need to make two copies(resized) of that image to another two field(thumb_big and thumb_small). Thumb_big will be 225px width, height could be anything. and thumb_small is 65x50px.

I searched but nothing seems to fit in my problem. I Have installed PIL. Tried django-imagekit, some other snipets.

If you know any link that will be great also, BTW I am a django newbie but you assume that already, right?

here is my model

class Photo(models.Model):
    title = models.CharField(max_length=500)
    pub_date = models.DateField(auto_now_add=True)
    mod_date = models.DateField(auto_now=True)
    slug_name = models.SlugField(max_length=500)
    image = models.ImageField(upload_to='interview', blank=True)
    thumb_big = models.ImageField(upload_to= 'interview/thumbs_big', blank=True)
    thumb_small = models.ImageField(upload_to= 'interview/thumbs_small', blank=True)
    category = models.CharField(max_length=200, blank=True)
    details = models.TextField()

    def __unicode__(self):
        return self.title
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:49:36+00:00Added an answer on May 24, 2026 at 7:49 am

    I’m not quite sure why would you need to store thumbnail paths in the database.
    There are several django thumbnail applications.
    Two of my favorites are:

    • sorl-thumbnail – https://github.com/sorl/sorl-thumbnail
    • easy-thumbnails – https://github.com/SmileyChris/easy-thumbnails

    Both of them are using template tags for generating thumbnails on the fly,
    and display them in your django templates.

    They also come with custom database fields to make thumbnail management easier:
    http://thumbnail.sorl.net/examples.html#model-examples
    http://packages.python.org/easy-thumbnails/usage.html#models

    If you really need to save paths to your thumbnails in your model, you can generate both thumbnails in your image upload view, and then assign resulting file paths to corresponding database fields. With easy thumbnail it will look like:

    photo = form.save()
    from easy_thumbnails.files import get_thumbnailer
    thumbnailer = get_thumbnailer(photo.image)
    thumb = thumbnailer.get_thumbnail({'size': (100, 100)})
    photo.thumb_big = thumb.name
    photo.save()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this model which has Image field to be uploaded. It has a
Let's say i have many models like that: class ExampleModel(models.Model): photo = models.ImageField(upload_to='photos/') image
I have a View Model that has some serious nesting. I need to populate
I have a custom list, and I've added a 'Page Image' field by clicking
I have a div that contains 3 fields You can see the image here
I have image data and i want to get a sub image of that
I have: image 1:Many imageToTag Many:1 tag I want to issue a query that
I have a model with ImagePath and PDFPath properties. When they click save, that
I have 2 scenarios that I need some help with re validation in my
I need to make a dynamic menu in java swing. I have a database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.