A django application to resize images using the thumbor service
Project description
A django application to resize images using the thumbor service.
Usage
Both thumbor_url templatetag and the generate_url helper uses the same arguments as libthumbor, you can check the wiki for more info.
On templates:
{% load thumbor_tags %}
<img src="{% thumbor_url '/media/image.jpg' width=300 %}" width="300" />
Split filters with : (or use a list object):
{% load thumbor_tags %}
<img src="{% thumbor_url url filters='watermark(http://domain.com/watermark.png,-10,-10,20):brightness(10)' %}" />
<img src="{% thumbor_url url filters=filter_list %}" />
On code:
from django_thumbor import generate_url
resized = generate_url("/media/image.jpg", width=300)
There is an extra parameter to specify a custom server to be used instead of settings.THUMBOR_SERVER.
On templates:
{% load thumbor_tags %}
<img src="{% thumbor_url '/media/image.jpg' thumbor_server='http://localhost:8888/foo' width=300 %}" width="300" />
On code:
from django_thumbor import generate_url
custom_server = "http://localhost:8888/foo"
resized = generate_url(
"/media/image.jpg", thumbor_server=custom_server, width=300)
Installation
pip install django-thumbor
Configuration
Add the app to the INSTALLED_APPS:
INSTALLED_APPS = (
# ...
'django_thumbor',
)
Here are the default settings that you can override:
# The host serving the thumbor resized images
THUMBOR_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 images
THUMBOR_MEDIA_URL = 'http://localhost:8000/media'
# The same security key used in the thumbor service to
# match the URL construction
THUMBOR_SECURITY_KEY = 'MY_SECURE_KEY'
# Default arguments passed to the `generate_url` helper or
# the `thumbor_url` templatetag
THUMBOR_ARGUMENTS = {}
Contributing
Install
Fork, clone, create a virtualenv and run:
git clone git://github.com/ricobl/django-thumbor.git
mkvirtualenv django-thumbor
make install
Test
Add tests on testproject/tests, add code and run:
make test
Contributors
@ricobl
@Starou
@avelino
@hakanw
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-thumbor-0.5.1.tar.gz
.
File metadata
- Download URL: django-thumbor-0.5.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba72c8f2133ef2be925f0cbb67c42867541e43646ffff1f91b43a41ba0009af7 |
|
MD5 | e369ed5b0a716199ee8329b2a7d5a687 |
|
BLAKE2b-256 | 791a787b5f7b494f3c8361cb24171e4125b341a0fbf3e3adf83733e37eaa383a |