You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+85-37Lines changed: 85 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,44 @@ ImageKit Angular SDK allows you to resize, optimize, deliver, and upload images
11
11
12
12
ImageKit is complete media storage, optimization, and transformation solution that comes with an image and video CDN. It can be integrated with your existing infrastructure - storage like AWS S3, web servers, your CDN, and custom domain names, allowing you to deliver optimized images in minutes with minimal code changes.
13
13
14
+
## Breaking changes - Upgrading from 2.x to 3.x version
15
+
3.x version has breaking changes as listed below.
16
+
* In version 3.0.0, we have deprecated the use of the `authenticationEndpoint` parameter. Instead, the SDK now introduces a new parameter named `authenticator`. This parameter expects an asynchronous function that resolves with an object containing the necessary security parameters i.e `signature`, `token`, and `expire`.
17
+
18
+
Example implementation for `authenticator` using `Fetch API`.
19
+
20
+
```javascript
21
+
22
+
authenticator =async () => {
23
+
try {
24
+
25
+
// You can pass headers as well and later validate the request source in the backend, or you can use headers for any other use case.
26
+
constheaders= {
27
+
'Authorization':'Bearer your-access-token',
28
+
'CustomHeader':'CustomValue'
29
+
};
30
+
31
+
constresponse=awaitfetch('server_endpoint', {
32
+
headers
33
+
});
34
+
35
+
if (!response.ok) {
36
+
consterrorText=awaitresponse.text();
37
+
thrownewError(`Request failed with status ${response.status}: ${errorText}`);
*Note*: Avoid generating security parameters on the client side. Always send a request to your backend to retrieve security parameters, as the generation of these parameters necessitates the use of your Imagekit `privateKey`, which must not be included in client-side code.
50
+
51
+
14
52
## Installation
15
53
16
54
```shell
@@ -45,7 +83,6 @@ To use the SDK, you need to provide it with a few configuration parameters. The
@@ -54,7 +91,7 @@ To use the SDK, you need to provide it with a few configuration parameters. The
54
91
```
55
92
56
93
*`urlEndpoint` is required to use the SDK. You can get URL-endpoint from your ImageKit dashboard - https://imagekit.io/dashboard/url-endpoints.
57
-
*`publicKey` and `authenticationEndpoint` parameters are required if you want to use the SDK for client-side file upload. You can get `publicKey` from the developer section in your ImageKit dashboard - https://imagekit.io/dashboard/developer/api-keys.
94
+
*`publicKey` and `authenticator` parameters are required if you want to use the SDK for client-side file upload. You can get `publicKey` from the developer section in your ImageKit dashboard - https://imagekit.io/dashboard/developer/api-keys.
58
95
*`transformationPosition` is optional. The default value for the parameter is `path`. Acceptable values are `path` & `query`
59
96
60
97
> Note: Do not include your [private key](https://docs.imagekit.io/api-reference/api-introduction/api-keys#private-key) in any client-side code.
@@ -101,6 +138,12 @@ To use the SDK, you need to provide it with a few configuration parameters. The
@@ -138,6 +181,15 @@ To use the SDK, you need to provide it with a few configuration parameters. The
138
181
fileName="test.jpg"
139
182
(onError)="handleUploadError($event)"
140
183
(onSuccess)="handleUploadSuccess($event)"
184
+
[tags]='["sample-tag1", "sample-tag2"]'
185
+
customCoordinates="10,10,10,10"
186
+
[isPrivateFile]="false"
187
+
[responseFields]='["tags"]'
188
+
folder="/sample-folder"
189
+
[validateFile]="validateFileFunction"
190
+
[onUploadStart]="onUploadStartFunction"
191
+
[onUploadProgress]="onUploadProgressFunction"
192
+
[authenticator]="authenticator"
141
193
></ik-upload>
142
194
```
143
195
@@ -178,7 +230,7 @@ The `ik-image` component renders an `img` tag. It is used for rendering and mani
178
230
The `transformation` prop is an array of objects. Each object can have the following properties. When you specify more than one object, each object is added as a chained transformation. For example:
@@ -228,34 +280,6 @@ See the complete list of transformations supported in ImageKit [here](https://do
228
280
| rotation | rt |
229
281
| blur | bl |
230
282
| named | n |
231
-
| overlayX | ox |
232
-
| overlayY | oy |
233
-
| overlayFocus | ofo |
234
-
| overlayHeight | oh |
235
-
| overlayWidth | ow |
236
-
| overlayImage | oi |
237
-
| overlayImageTrim | oit |
238
-
| overlayImageAspectRatio | oiar |
239
-
| overlayImageBackground | oibg |
240
-
| overlayImageBorder | oib |
241
-
| overlayImageDPR | oidpr |
242
-
| overlayImageQuality | oiq |
243
-
| overlayImageCropping | oic |
244
-
| overlayImageTrim | oit |
245
-
| overlayText | ot |
246
-
| overlayTextFontSize | ots |
247
-
| overlayTextFontFamily | otf |
248
-
| overlayTextColor | otc |
249
-
| overlayTextTransparency | oa |
250
-
| overlayAlpha | oa |
251
-
| overlayTextTypography | ott |
252
-
| overlayBackground | obg |
253
-
| overlayTextEncoded | ote |
254
-
| overlayTextWidth | otw |
255
-
| overlayTextBackground | otbg |
256
-
| overlayTextPadding | otp |
257
-
| overlayTextInnerAlignment | otia |
258
-
| overlayRadius | or |
259
283
| progressive | pr |
260
284
| lossless | lo |
261
285
| trim | t |
@@ -436,9 +460,9 @@ The SDK provides a component to upload files to the [ImageKit Media Library](htt
436
460
| onError | Function callback | Optional. EventEmitter. Called if the upload results in error. The first and only argument is the error received from the upload API |
437
461
| urlEndpoint | String | Optional. For example, https://ik.imagekit.io/your_imagekit_id/endpoint/|
Note: All three `urlEndpoint`, `publicKey`and `authenticationEndpoint` must be present in the attribute for them to take effect. Otherwise, the SDK will fall back to the values specified in `app.module.ts`.
465
+
Note: `urlEndpoint`and `publicKey` must be present in the attribute for them to take effect. Otherwise, the SDK will fall back to the values specified in `app.module.ts`.
442
466
443
467
Sample usage
444
468
@@ -505,6 +529,32 @@ Custom button example, using buttonRef
505
529
</button>
506
530
```
507
531
532
+
Abort upload
533
+
534
+
```js
535
+
// Added to app.component.ts
536
+
@ViewChild('upload') uploadComponent:IkUploadComponent;// @ViewChild can be used to get instance of IKUpload component.
0 commit comments