Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Usage

Diego Manhães Pinheiro edited this page · 6 revisions
Clone this wiki locally

IMPORTANT NOTICE: As of 1.0 libthumbor by default generates URLs compatible only with thumbor >= 3.0.0. If you need to generate URLs for older versions of thumbor you'll need to pass old=True to CryptoURL.generate

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' - vertical alignment that thumbor should use for cropping;

fit_in = <bool> - flag that indicates that thumbor should fit the image in the box defined by width x height;

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

unsafe = <bool> - flag that indicates that thumbor doesn't need to decrypt the url;

If you are using Django, proceed to our Django Support page. Otherwise, you can check the Security page

Something went wrong with that request. Please try again.