[Answered ]-Django and ImageField Question

2👍

Signals are the answer to both of your questions.

As stated in the docs, the height_field and width_field are names of fields where to store the original image’s height and width — not to coerce the image to a certain size. I think the best way to handle what you want to do is to use either the pre_save or post_save signal to resize the image using PIL. You may also want to check out sorl. In fact, you can use the sorl’s thumbnail in your signal to create the new image.

To rename the filename, also use a signal.

👤rz.

Leave a comment