Question

I found a question (and an answer) related to sorl-thumbnail that looks like a good point related to what I’m looking for : Image filtering with the new sorl-thumbnail. But my django knowledge is far too weak to understand what I could do with that.

I’d like to extend sorll-thumbnail so that I could process an image before serving it. For example : add a blur effect. I can deal with the image processing part (already done such things with php/imagemagick), but I don’t know where to start to plug my own function above sorl-thumbnail.

In my project, I installed the lib with pip. Where in my code can I create a class/subclass so that I could pass an argument to the templatetag? What should this class look like?

Is the RoundedCornerEngine class described in the mentioned post ok ? Where should I have this code ?

Thanks for your help.

Was it helpful?

Solution

Anywhere… Ok… The only detail is to correctly link the new Engine from the settings :

THUMBNAIL_ENGINE = "my.module.MyEngine"

If anyone is looking for custom processors, built with PIL on top of sorl-thumbnail, here are two examples : https://gist.github.com/1647660 and https://gist.github.com/1920535.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top