That's actually real clean - thanks for sharing.

On Wed, Apr 30, 2014 at 4:17 AM, Brad Bode <[email protected]> wrote:

> Solved... for now. Although I wouldn't call it a bug I got the most help
> out of this bug listing :
> https://github.com/stephenmcd/mezzanine/issues/530
>
> So the solution for me was two fold. First, I had to make sure all usages
> of the mezzanine thumbnail tag would work. Ideally this would be done
> without actually modifying mezzanine code. I chose and test 
> Sorl-Thumbnail<https://github.com/mariocesar/sorl-thumbnail>,
> which works with S3.
>
> I monkey patched the code to replace the implementation of the template
> tag first. You have to do this so that ALL usages of the template tag defer
> to the Sorl version (which works with S3). Remember, the app that registers
> this new tag, must come AFTER the mezzanine core app which registers the
> original.
>
>     from django import template
>     from sorl.thumbnail import get_thumbnail
>     from mezzanine.core.templatetags import mezzanine_tags
>
>     register = template.get_library("mezzanine_tags")
>
>     @register.simple_tag
>     def thumbnail(image_url, width, height, quality=95, left=0.5, top=0.5):
>         im = get_thumbnail(image_url, "%sx%s" % (width, height),
> crop='center', quality=quality)
>         return im.url
>
> But in order to get the Mezzanine thumbnails to work in the Admin
> Interface you will need to replace the method directly (the admin uses a
> direct method call not the template tag):
>
>     mezzanine_tags.thumbnail = thumbnail
>
> And finally, MAKE SURE that the module that registers this tag is register
> AFTER mezzanine otherwise it will not overwrite the mezzanine template tag.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to