thumbor_client v0.3.0 ThumborClient.UrlBuilder

Module to build url with params

Link to this section Summary

Functions

Use orientation to crop image

Adding filters to image. The option must be a List of strings. You can see all filters in https://github.com/thumbor/thumbor/wiki/Filters

Get full path image passing options

Add url image when receive options[:image]

Instead of get the image, get all meta data informations in image returning using json

Add sizes to url image

Add url parameter smart to crop better images. Thumbor has algorithms to crop using facial recognition process

Removes surrounding space in images using top-left pixel color unless specified otherwise

Link to this section Functions

Link to this function align(path, options, orientation)

Use orientation to crop image.

Parameters: path: List with anothers attributes to build url options: Could be: :top, :left, :center, :right, :bottom orientation: Could be: :halign or :valign

Examples

iex> ThumborClient.UrlBuilder.align([“300x200”], %{valign: :top}, :valign) [“300x200”, “top”]

Link to this function filters(path, options)

Adding filters to image. The option must be a List of strings. You can see all filters in https://github.com/thumbor/thumbor/wiki/Filters

Examples

iex> ThumborClient.UrlBuilder.filters([“300x300”], %{filters: [“rotate(30)”, “brightness(40)”]}) [“300x300”, “filters:rotate(30):brightness(40)”]

Link to this function full_path(options)

Get full path image passing options.

Link to this function image(path, options)

Add url image when receive options[:image]

Examples

iex> ThumborClient.UrlBuilder.image([], %{image: “path/to/image.jpg”}) [“path/to/image.jpg”]

Link to this function meta(path, options)

Instead of get the image, get all meta data informations in image returning using json

Examples

iex> ThumborClient.UrlBuilder.meta([“300x200”], %{meta: true}) [“300x200”, “meta”]

Link to this function sizes(path, options)

Add sizes to url image

Examples

iex> ThumborClient.UrlBuilder.sizes([], %{width: 300, height: 200}) [“300x200”]

Link to this function smart(path, options)

Add url parameter smart to crop better images. Thumbor has algorithms to crop using facial recognition process.

Examples

iex> ThumborClient.UrlBuilder.smart([“300x200”], %{smart: true}) [“300x200”, “smart”]

Link to this function trim(path, options)

Removes surrounding space in images using top-left pixel color unless specified otherwise

Unless specified trim assumes the top-left pixel color and no tolerance (more on tolerance below).

To use it, just add a trim: true.

If you need to specify the orientation from where to get the pixel color, just use trim: “top-left” for the top-left pixel color, for example

Trim also supports color tolerance. The euclidian distance between the colors of the reference pixel and the surrounding pixels is used. If the distance is within the tolerance they’ll get trimmed. For a RGB image the tolerance would be within the range 0-442. The tolerance can be specified like this: trim: “top-left:50”

Examples

iex> ThumborClient.UrlBuilder.trim([“300x200”], %{trim: “bottom-left”}) [“300x200”, “trim:bottom-left”]

iex> ThumborClient.UrlBuilder.trim([“300x200”], %{trim: true}) [“300x200”, “trim”]