1
1
# Thumbox
2
2
3
+ Generate secure [ thumbor] ( http://thumbor.org ) urls on the fly.
4
+
3
5
[ ![ Build Status] ( https://travis-ci.org/webdeb/thumbox.svg?branch=master )] ( https://travis-ci.org/webdeb/thumbox )
4
6
7
+ #### The signature generation is tested against the original thumbor implemention.
8
+
5
9
## Installation
6
10
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
8
12
by adding ` thumbox ` to your list of dependencies in ` mix.exs ` :
9
13
10
14
``` elixir
@@ -15,6 +19,33 @@ def deps do
15
19
end
16
20
```
17
21
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