ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - globocom/thumbor-client-ex: Client to thumbor using Elixir
Client to thumbor using Elixir. Contribute to globocom/thumbor-client-ex development by creating an account on GitHub.
Visit Site

GitHub - globocom/thumbor-client-ex: Client to thumbor using Elixir

GitHub - globocom/thumbor-client-ex: Client to thumbor using Elixir

Build Status HitCount

ThumborClient

This package is a client to generate URLs to Thumbor using Elixir language.

Installation

The package can be installed by adding thumbor_client to your list of dependencies in mix.exs:

def deps do
  [
    {:thumbor_client, "~> 0.4.0"}
  ]
end

Usage

In safe mode

iex> client = ThumborClient.client("my_secret_token")
iex> client.(%{image: "path/to/image.jpg", width: 500, height: 500})
"1_6x25QaeExcQVmtuNyrr_lOs-0=/500/500/path/to/image.jpg"

In unsafe mode

iex> client = ThumborClient.client()
iex> client.("%{image: "path/to/image.jpg", width: 500, height: 500})
"unsafe/500/500/path/to/image.jpg"

Another way to generate

The method client("key") is recommended if you will generate multiple images in same function. If you prefer, you can call the method generate without this HOF.

iex> ThumborClient.generate(%{image: "image.jpg", width: 500, height: 500}, "my_secret_token")
# The last parameter is optional, if not exist should use unsafe mode

Options

Option Default Value Description
trim: (bool) false Removes surrounding space in image using top-left pixel color unless specified otherwise
meta: (bool) false Instead of get the image, get all meta data informations in image returning using json
fit: (atom|nil) nil The fit argument specifies that the image should not be auto-cropped and auto-resized to be EXACTLY the specified size. Possible values: :fit_in, :adaptive_fit_in, :full_fit_in, :adaptive_full_fit_in
width: (integer) 0 Final width of image
height: (integer) 0 Final height of image
flip: (bool) false Flip image horizontaly
flop: (bool) false Flip image verticaly
halign: (atom)   :center       Orientation to crop horizontaly. Possible values: :left, :center, :right                                                                                                                              
valign: (atom)   :center       Orientation to crop verticaly. Possible values: :top, :center, :bottom                                                                                                                                
smart: (bool) false Use Thumbor algorithms to crop using facial recognition process
filters: (list) [] Adding filters to image. More details bellow
image: (string) nil Path of image. Can be external.

Filters

You can see a big list of filters in official Thumbor documentation. You must set a list of strings with values.

Examples of usage:

Brightness

ThumborClient.generate(%{filters: ["brightness(40)"], width: 400, height: 300, path: "/path/image.jpg"})

Blur

ThumborClient.generate(%{filters: ["blur(40)"], width: 400, height: 300, path: "/path/image.jpg"})

Grayscale

ThumborClient.generate(%{filters: ["grayscale()"], width: 400, height: 300, path: "/path/image.jpg"})

Multiple filters

ThumborClient.generate(%{filters: ["grayscale()", "rotate(90)", "saturate(20)"], width: 400, height: 300, path: "/path/image.jpg"})

Docs

The docs can be found at https://hexdocs.pm/thumbor_client.

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory