Search code examples
thumbnailsimage-resizingthumbor

thumbor // url syntax to crop and apply filter at the same time


For the ones that uses it, if it is ever possible

Looking though the docs, can't find a clue about building an url that would crop the image and apply a filter at the same time

Thanks for the help


Solution

  • Sure thing, the syntax would be like this:

    http://<your_thumbor_server>/unsafe/<crop>/filters:<some_filter>/<image_source_url>
    

    Which might look something like this:

    http://thumborhost.com/unsafe/200x0:600x800/filters:format(webp)/http://imagehost.com/path/to/source.jpg
    

    The full url syntax as stated by the Thumbor docs is:

    http://thumbor-server/hmac/trim/AxB:CxD/fit-in/-Ex-F/HALIGN/VALIGN/smart/filters:FILTERNAME(ARGUMENT):FILTERNAME(ARGUMENT)/image-uri

    Docs: http://thumbor.readthedocs.org/en/latest/usage.html