Generate secure thumbor urls on the fly.
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 :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"
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.
MIT