Skip to content
Bernardo Heynemann edited this page Feb 14, 2020 · 7 revisions

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

Clone this wiki locally