imgex v0.1.0 Imgex
Provides functions to generate secure Imgix URLs.
Summary
Functions
Provides configured source information when it’s not passed explicitly to url/3 or proxy_url/3
Generates a secure Imgix URL from a Web Proxy source given:
path
- The full public image URL.params
- (optional) Imgix API parameters used to manipulate the image.source
- (optional) A map containing Imgix source information::token
- The secure token used to sign API requests.:domain
- The Imgix source domain
Generates a secure Imgix URL given:
path
- The URL path to the image.params
- (optional) Imgix API parameters used to manipulate the image.source
- (optional) A map containing Imgix source information::token
- The secure token used to sign API requests.:domain
- The Imgix source domain
Functions
Provides configured source information when it’s not passed explicitly to url/3 or proxy_url/3.
Generates a secure Imgix URL from a Web Proxy source given:
path
- The full public image URL.params
- (optional) Imgix API parameters used to manipulate the image.source
- (optional) A map containing Imgix source information::token
- The secure token used to sign API requests.:domain
- The Imgix source domain.
Examples
iex> Imgex.proxy_url "http://avatars.com/john-smith.png"
"https://my-social-network.imgix.net/http%3A%2F%2Favatars.com%2Fjohn-smith.png?s=493a52f008c91416351f8b33d4883135"
iex> Imgex.proxy_url "http://avatars.com/john-smith.png", %{w: 400, h: 300}
"https://my-social-network.imgix.net/http%3A%2F%2Favatars.com%2Fjohn-smith.png?h=300&w=400&s=a201fe1a3caef4944dcb40f6ce99e746"
Generates a secure Imgix URL given:
path
- The URL path to the image.params
- (optional) Imgix API parameters used to manipulate the image.source
- (optional) A map containing Imgix source information::token
- The secure token used to sign API requests.:domain
- The Imgix source domain.
Examples
iex> Imgex.url "/images/jets.png"
"https://my-social-network.imgix.net/images/jets.png?s=7c6a3ef8679f4965f5aaecb66547fa61"
iex> Imgex.url "/images/jets.png", %{con: 10}, %{domain: "https://cannonball.imgix.net", token: "xxx187xxx"}
"https://cannonball.imgix.net/images/jets.png?con=10&s=d982f04bbca4d819971496524aa5f95a"