Skip to content
heynemann edited this page Apr 15, 2011 · 7 revisions

libthumbor is the python companion to the amazing thumbor imaging service.

Using it

from libthumbor import CryptoURL

crypto = CryptoURL(key='my-security-key')

encrypted_url = crypto.generate(
    width=300,
    height=200,
    smart=True,
    image_url='/path/to/my/image.jpg'
)

The full list of arguments to generate and it's default values are:

meta = bool - flag that indicates that thumbor should return only meta-data on the operations it would
                otherwise perform;

crop = ((<int>, <int>), (<int>, <int>)) - Coordinates for manual cropping. The first pair are X and Y coordinates
                                        for the left, top point and the second pair are X and Y coordinates
                                        for the right, bottom point (thus forming the square to crop);

width = <int> - the width for the thumbnail;

height = <int> - the height for the thumbnail;

flip = <bool> - flag that indicates that thumbor should flip horizontally (on the vertical axis) the image;

flop = <bool> - flag that indicates that thumbor should flip vertically (on the horizontal axis) the image;

halign = 'left', 'center' or 'right' - horizontal alignment that thumbor should use for cropping;

valign = 'top', 'middle' or 'bottom' - horizontal alignment that thumbor should use for cropping;

smart = <bool> - flag that indicates that thumbor should use smart cropping;

Encryption

libthumbor follows the encryption direction in thumbor security page and will be up-to-date with thumbor development.

Clone this wiki locally