Package: hmtvltk2-django-thumbor
A django application to resize images using thethumborservice.UsageBoththumbor_urltemplatetag and thegenerate_urlhelper uses the same
arguments aslibthumbor, you can
check thewikifor more info.On templates:{% load thumbor_tags %}<imgsrc="{% thumbor_url '/media/image.jpg' width=300 %}"width="300"/>or

{% load thumbor_tags %}<imgsrc="{% thumbor_url model.image_field width=300 %}"width="300"/>If you need the result in a template variable, useassign_thumbor_urlinstead.{% load thumbor_tags %}
{% assign_thumbor_url ‘/media/image.jpg’ width=300 as thumb_url %}
<img src=”{{ thumb_url }}” width=”300” />FiltersSplitfilterswith:(or use alistobject):{% load thumbor_tags %}<imgsrc="{% thumbor_url url filters='watermark(http://domain.com/watermark.png,-10,-10,20):brightness(10)' %}"/><imgsrc="{% thumbor_url url filters=filter_list %}"/>On code:fromdjango_thumborimportgenerate_urlresized=generate_url("/media/image.jpg",width=300)Re-using argument sets (aliases)You can re-use argument sets through globally defined aliases. This prevents
repeating thumbnail parameters all over the code and can improve thumbor
performance because thumbnails are re-used as well. If you’re migrating
from django-easy-thumbnails, you’ll find the pattern very familiar, and it
should make porting much more straight-forward.On templates:{% load thumbor_tags %}<imgsrc="{% thumbor_url '/media/image.jpg' alias="thumb-square"%}"/>On code:fromdjango_thumborimportgenerate_urlresized=generate_url("/media/image.jpg",alias="thumb-square")And in yoursettings.py:THUMBOR_ALIASES={'thumb-square':{'width':300,'height':300,'filters':['brightness(10)']}}Override server addressThere is an extra parameter to specify a custom server to be used instead ofsettings.THUMBOR_SERVER.On templates:{% load thumbor_tags %}<imgsrc="{% thumbor_url '/media/image.jpg' thumbor_server='http://localhost:8888/foo' width=300 %}"width="300"/>On code:fromdjango_thumborimportgenerate_urlcustom_server="http://localhost:8888/foo"resized=generate_url("/media/image.jpg",thumbor_server=custom_server,width=300)Installationpipinstalldjango-thumborConfigurationAdd the app to theINSTALLED_APPS:INSTALLED_APPS=(# ...'django_thumbor',)Here are the default settings that you can override:# The host serving the thumbor resized imagesTHUMBOR_SERVER='http://localhost:8888'# The prefix for the host serving the original images# This must be a resolvable address to allow thumbor to reach the imagesTHUMBOR_MEDIA_URL='http://localhost:8000/media'# If you want the static to be handled by django thumbor# default as False, set True to handle it if you host your staticsTHUMBOR_STATIC_ENABLED=False# The prefix for the host serving the original static images# this must be a resolvable address to allow thumbor to reach the imagesTHUMBOR_STATIC_URL='http://localhost:8000/static'# The same security key used in the thumbor service to# match the URL constructionTHUMBOR_SECURITY_KEY='MY_SECURE_KEY'# Default arguments passed to the `generate_url` helper or# the `thumbor_url` templatetagTHUMBOR_ARGUMENTS={}# An alias represents a named set of arguments to the generate_url function# or thumbor_url template tag. Use it to share general thumbnail# configurations without repeating yourself.THUMBOR_ALIASES={}ContributingInstallFork, clone, create a virtualenv and run:gitclonegit://github.com/ricobl/django-thumbor.gitmkvirtualenvdjango-thumbormakeinstallTestAdd tests ontestproject/tests, add code and run:maketest