Documentation ¶
Overview ¶
Package libpixel provides a Client to generate and sign LibPixel URLs.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
The Client to sign and/or generate URLs with.
func (*Client) Sign ¶
Sign generates and adds a signature to a URL. A Secret must be provided in the Client for this method to work. Returns the signed URL.
Example ¶
c := &Client{Secret: "TOP-SECRET"} url, err := c.Sign("http://test.libpx.com/images/1.jpg") if err == nil { fmt.Println(url) }
Output: http://test.libpx.com/images/1.jpg?signature=e20add8e4c64f38c1a3bf27a6ba816f6ce85b40f
func (*Client) URL ¶
URL generates a LibPixel URL for a given path and Params. If the Client has a Secret defined, the URL will automatically be signed. The Client must define a Host for this method to work. Returns the generated URL.
Example ¶
c := &Client{Host: "test.libpx.com", Secret: "TOP-SECRET"} url, err := c.URL("/images/1.jpg", Params{"width": 600, "blur": 20}) if err == nil { fmt.Println(url) }
Output: http://test.libpx.com/images/1.jpg?blur=20&width=600&signature=199cb62b964d9ddef84eaf3a7df30d41fa398b74
type Params ¶
type Params map[string]interface{}
Params for the LibPixel Image API.
For API documentation, see: http://libpixel.com/docs/#image-api
Click to show internal directories.
Click to hide internal directories.