Skip to content

Commit f2fda53

Browse files
author
Marius Kleidl
committed
Add example for signed Smart CDN URLs
1 parent 20e8720 commit f2fda53

File tree

1 file changed

+33
-0
lines changed
  • examples/smart-cdn-signature

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"net/url"
6+
7+
transloadit "github.com/transloadit/go-sdk"
8+
)
9+
10+
func main() {
11+
url := GetSmartCDNUrl()
12+
fmt.Println(url)
13+
}
14+
15+
func GetSmartCDNUrl() string {
16+
options := transloadit.DefaultConfig
17+
options.AuthKey = "YOUR_TRANSLOADIT_KEY"
18+
options.AuthSecret = "YOUR_TRANSLOADIT_SECRET"
19+
client := transloadit.NewClient(options)
20+
21+
params := url.Values{}
22+
params.Add("height", "100")
23+
params.Add("width", "100")
24+
25+
url := client.CreateSignedSmartCDNUrl(transloadit.SignedSmartCDNUrlOptions{
26+
Workspace: "YOUR_WORKSPACE",
27+
Template: "YOUR_TEMPLATE",
28+
Input: "image.png",
29+
URLParams: params,
30+
})
31+
32+
return url
33+
}

0 commit comments

Comments
 (0)