Skip to content

Commit 537ee24

Browse files
authored
fix: update imagekit crop options and add crop mode (#158)
1 parent 97e5db0 commit 537ee24

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/providers/imagekit.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,16 @@ Deno.test("imagekit generate", async (t) => {
130130
const result = generate(img, {
131131
w: 400,
132132
h: 300,
133-
c: "pad_resize",
133+
cm: "pad_resize",
134+
c: "at_max_enlarge",
134135
fo: "bottom",
135136
bg: "FFFFFF",
136137
r: 90,
137138
q: 85,
138139
});
139140
assertEqualIgnoringQueryOrder(
140141
result,
141-
`${img}?tr=w-400,h-300,c-pad_resize,fo-bottom,bg-FFFFFF,r-90,q-85`,
142+
`${img}?tr=w-400,h-300,cm-pad_resize,c-at_max_enlarge,fo-bottom,bg-FFFFFF,r-90,q-85`,
142143
);
143144
},
144145
);

src/providers/imagekit.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,24 @@ export interface ImageKitOperations extends Operations {
3232

3333
/**
3434
* Crop strategy for the image.
35-
* Options: 'maintain_ratio', 'extract', 'pad_resize', 'force', 'at_max', 'at_least'
35+
* Options: 'maintain_ratio', 'force', 'at_max', 'at_max_enlarge', 'at_least'
3636
*/
3737
c?:
3838
| "maintain_ratio"
39-
| "extract"
40-
| "pad_resize"
4139
| "force"
4240
| "at_max"
41+
| "at_max_enlarge"
4342
| "at_least";
4443

44+
/**
45+
* Crop mode for the image.
46+
* Options: 'extract', 'pad_resize', 'pad_extract'
47+
*/
48+
cm?:
49+
| "extract"
50+
| "pad_resize"
51+
| "pad_extract";
52+
4553
/**
4654
* Focal point for cropping. Can also pass object types for smart cropping.
4755
* @see https://imagekit.io/docs/image-resize-and-crop#supported-object-list

0 commit comments

Comments
 (0)