Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.29 KB

README.md

File metadata and controls

53 lines (37 loc) · 1.29 KB

Thumbox

Generate secure thumbor urls on the fly.

Build Status HitCount

The signature generation is tested against the original thumbor implemention.

Installation

available in Hex, the package can be installed by adding thumbox to your list of dependencies in mix.exs:

def deps do
  [
    {:thumbox, "~> 0.1.0"}
  ]
end

Config

config :thumbox,
  server: "https://thumbor.example.com", # The thumbor server
  origin: "my-app.com", # The hostname of the original images
  secret: "s3cr3t", # The shared secret key
  types: %{
    # Define your image types
    profile_avatar: "200x200/smart",
    blog_header: "1024x360",
  }

Note: The origin option can also be an internal hostname, like "app"

Usage

gen_url(type, path, opts \\ [])

Thumbox.gen_url(:profile_avatar, "uploads/some-user-avatar.jpg")
=> "https://thumbor.example.com/<hmac-signature>/200x200/smart/my-app.com/uploads/some-user-avatar.jpg"

opts: You can also pass any option from the config to the url generation on the fly.

License

MIT