https://github.com/webdeb/thumbox
thumbor helpers in elixir
https://github.com/webdeb/thumbox
Last synced: 5 months ago
JSON representation
thumbor helpers in elixir
- Host: GitHub
- URL: https://github.com/webdeb/thumbox
- Owner: webdeb
- License: mit
- Created: 2018-05-01T22:02:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-10-20T15:31:56.000Z (over 4 years ago)
- Last Synced: 2025-10-21T15:36:41.454Z (9 months ago)
- Language: Elixir
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Thumbox
Generate secure [thumbor](http://thumbor.org) urls on the fly.
[](https://travis-ci.org/webdeb/thumbox)
[](http://hits.dwyl.io/webdeb/thumbox)
#### The signature generation is tested against the original thumbor implemention.
## Installation
[available in Hex](https://hex.pm/packages/thumbox), the package can be installed
by adding `thumbox` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:thumbox, "~> 0.1.0"}
]
end
```
## Config
```elixir
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 \\\ [])
```elixir
Thumbox.gen_url(:profile_avatar, "uploads/some-user-avatar.jpg")
=> "https://thumbor.example.com//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