Avoiding thumbnail name collisions with sorl-thumbnail

Posted by Owen Nelson on Stack Overflow See other posts from Stack Overflow or by Owen Nelson
Published on 2010-04-02T17:33:19Z Indexed on 2010/04/02 19:03 UTC
Read the original article Hit count: 423

Filed under:
|
|

Understanding that I should probably just dig into the source to come up with a solution, I'm wondering if anyone has come up with a tactic for dealing with this.

In my project, I have a lot of images being generated outside of the application. I'm isolating them on the filesystem based on a model's pk.

For example, a model instance with a pk of 121 might have the following images:

.../thumbs/1/2/1/img.1.jpg
.../thumbs/1/2/1/img.2.jpg
...
.../thumbs/1/2/1/img.27.jpg

Since the image filenames themselves are not guaranteed to be unique, I'm looking for a way to inform sorl (at runtime) that I'd like to prefix thumbs for this model with the instance pk value. Is this even possible without patching sorl?

© Stack Overflow or respective owner

Related posts about django

Related posts about python