Skip to content

Commit 48aedc4

Browse files
committed
fixed examples url generation, removed attachment from transformation param
1 parent bd8e231 commit 48aedc4

File tree

4 files changed

+9
-19
lines changed

4 files changed

+9
-19
lines changed

examples/url-generation/main.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"log"
66

77
"github.com/imagekit-developer/imagekit-go"
8-
"github.com/imagekit-developer/imagekit-go/api"
98
ikurl "github.com/imagekit-developer/imagekit-go/url"
109
)
1110

@@ -18,17 +17,14 @@ func main() {
1817

1918
url, err := ik.Url(ikurl.UrlParam{
2019
Path: "/default-image.jpg",
21-
Transformations: []ikurl.Transformation{
20+
Transformations: []map[string]any{
2221
{
23-
Height: 300,
24-
Width: 300,
25-
26-
Overlay: &ikurl.Overlay{
27-
Image: "test2_5r9tRj4L4.gif",
28-
Width: api.Int(100),
29-
X: api.Int(0),
30-
ImageBorder: "10_CDDC39",
31-
},
22+
"height": 300,
23+
"width": 300,
24+
"overlayImage": "test2_5r9tRj4L4.gif",
25+
"overlayWidth": 100,
26+
"x": 0,
27+
"overlayImageBorder": "10_CDDC39",
3228
},
3329
},
3430
})

imagekit_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,13 @@ func TestUrl(t *testing.T) {
153153
"rotation": "auto",
154154
"radius": 40,
155155
"background": "344222",
156-
"attachment": true,
157156
"effectContrast": "-",
158157
"effectSharpen": "-",
159158
"raw": "x-1",
160159
},
161160
},
162161
},
163-
url: "https://ik.imagekit.io/dk1m7xkgi/tr:w-200,h-400,cm-extract,fo-center,x-100,y-110,q-85,f-auto,bl-5,dpr-auto,e-grayscale,di-test2_hBIIEweBy.gif,pr-true,lo-true,t-true,b-5_005500,cp-true,md-true,rt-auto,r-40,bg-344222,ik-attachment=true,e-sharpen,e-contrast,x-1/default-image.jpg",
162+
url: "https://ik.imagekit.io/dk1m7xkgi/tr:w-200,h-400,cm-extract,fo-center,x-100,y-110,q-85,f-auto,bl-5,dpr-auto,e-grayscale,di-test2_hBIIEweBy.gif,pr-true,lo-true,t-true,b-5_005500,cp-true,md-true,rt-auto,r-40,bg-344222,e-sharpen,e-contrast,x-1/default-image.jpg",
164163
}, {
165164
name: "aspect-ratio-xc-yc",
166165
params: ikurl.UrlParam{

url.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,7 @@ func transform(tr map[string]any) string {
133133
if prefix == "di" || prefix == "oi" {
134134
value = strings.ReplaceAll(strings.Trim(value, "/"), "/", "@@")
135135
}
136-
if k == "attachment" {
137-
parts = append(parts, prefix+"="+value)
138-
} else {
139-
parts = append(parts, prefix+"-"+value)
140-
}
136+
parts = append(parts, prefix+"-"+value)
141137
}
142138
}
143139

url/url.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,4 @@ var TransformationCode = map[string]string{
8585
"effectContrast": "e-contrast",
8686
"effectGray": "e-grayscale",
8787
"original": "orig",
88-
"attachment": "ik-attachment",
8988
}

0 commit comments

Comments
 (0)