Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e4bcf8f

Browse files
committedMay 15, 2018
Update Readme
1 parent 62cf1ed commit e4bcf8f

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed
 

‎README.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Thumbox
22

3+
Generate secure [thumbor](http://thumbor.org) urls on the fly.
4+
35
[![Build Status](https://travis-ci.org/webdeb/thumbox.svg?branch=master)](https://travis-ci.org/webdeb/thumbox)
46

7+
#### The signature generation is tested against the original thumbor implemention.
8+
59
## Installation
610

7-
[available in Hex](https://hex.pm/thumbox), the package can be installed
11+
[available in Hex](https://hex.pm/packages/thumbox), the package can be installed
812
by adding `thumbox` to your list of dependencies in `mix.exs`:
913

1014
```elixir
@@ -15,6 +19,33 @@ def deps do
1519
end
1620
```
1721

18-
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
19-
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
20-
be found at [https://hexdocs.pm/thumbox](https://hexdocs.pm/thumbox).
22+
## Config
23+
24+
```elixir
25+
config :thumbox,
26+
server: "https://thumbor.example.com", # The thumbor server
27+
origin: "my-app.com", # The hostname of the original images
28+
secret: "s3cr3t", # The shared secret key
29+
types: %{
30+
# Define your image types
31+
profile_avatar: "200x200/smart",
32+
blog_header: "1024x360",
33+
}
34+
```
35+
36+
_Note_: The origin option can also be an internal hostname, like "app"
37+
38+
## Usage
39+
40+
### gen_url(type, path, opts \\ [])
41+
42+
```elixir
43+
Thumbox.gen_url(:profile_avatar, "uploads/some-user-avatar.jpg")
44+
=> "https://thumbox.example.com/<hmac-signature>/200x200/smart/my-app.com/uploads/some-user-avatar.jpg"
45+
```
46+
47+
opts: You can also pass any option from the config to the url generation on the fly.
48+
49+
## License
50+
51+
MIT

0 commit comments

Comments
 (0)
Please sign in to comment.