Skip to content

webdeb/thumbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

thumbor helpers in elixir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published