Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ To use the SDK, you need to provide it with a few configuration parameters. The
}
]
}"
[checks]="'\'request.folder\' : \'sample-folder/\''" // To run server side checks before uploading files. Notice the quotes around request.folder and sample-folder.
></ik-upload>
```

Expand Down Expand Up @@ -562,6 +563,7 @@ The SDK provides a component to upload files to the [ImageKit Media Library](htt
| urlEndpoint | String | Optional. For example, https://ik.imagekit.io/your_imagekit_id/endpoint/ |
| publicKey | String | Optional |
| authenticator | ()=>Promise<{signature:string,token:string,expiry:number}> | Optional |
| checks | String | Optional. Run server-side checks before uploading files. For example, `"'file.size' < '1mb'"` will check if the file size is less than 1 MB. Check [Upload API docs](https://imagekit.io/docs/api-reference/upload-file/upload-file#upload-api-checks) to learn more. Notice the quotes around `file.size` and `1mb`; otherwise, you will get an error `Your request contains invalid syntax for the checks parameter.` |

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`.

Expand Down
3,556 changes: 1,779 additions & 1,777 deletions sdk/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imagekitio-angular",
"version": "5.0.0",
"version": "5.1.0",
"license": "MIT",
"scripts": {
"ng": "ng",
Expand All @@ -26,7 +26,7 @@
"@angular/platform-browser": "~12.2.0",
"@angular/platform-browser-dynamic": "~12.2.0",
"@angular/router": "~12.2.0",
"imagekit-javascript": "^3.0.0",
"imagekit-javascript": "^3.0.2",
"rxjs": "~6.6.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
Expand Down
4 changes: 2 additions & 2 deletions sdk/projects/imagekitio-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "imagekitio-angular",
"version": "5.0.0",
"version": "5.1.0",
"peerDependencies": {
"@angular/common": ">=12.2.0",
"@angular/core": ">=12.2.0",
"imagekit-javascript": "^3.0.0"
"imagekit-javascript": "^3.0.2"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class IkUploadComponent implements AfterViewInit {
@Input('onUploadStart') onUploadStart: (e: HTMLInputEvent) => void;
@Input('onUploadProgress') onUploadProgress: (e: ProgressEvent) => void;
@Input('transformation') transformation: Object; //optional
@Input('checks') checks: string; //optional
fileToUpload: File = null;
xhr: XMLHttpRequest;

Expand Down Expand Up @@ -76,6 +77,7 @@ export class IkUploadComponent implements AfterViewInit {
onError: this.onError,
onSuccess: this.onSuccess,
transformation: this.transformation,
checks: this.checks
}

// Custom validation
Expand Down Expand Up @@ -250,6 +252,11 @@ export class IkUploadComponent implements AfterViewInit {
if (options.transformation !== undefined) {
Object.assign(params, { transformation: options.transformation });
}

if (options.checks !== undefined) {
Object.assign(params, { checks: options.checks });
}

return params;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import ImageKit from 'imagekit-javascript';
const SDK_VERSION = '5.0.0';
const SDK_VERSION = '5.1.0';
export interface Lqip {
readonly active: boolean;
readonly quality: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface IkUploadComponentOptions {
validateFile?: Function;
xhr?: XMLHttpRequest;
transformation?: Object;
checks?: string;
}

export interface AuthResponse {
Expand Down
1 change: 1 addition & 0 deletions sdk/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ <h1>Hi! This is an ImageKit Angular SDK Demo!</h1>
[onUploadStart]="onUploadStartFunction"
[onUploadProgress]="onUploadProgressFunction"
[authenticator]="authenticator"
[checks]="'\'request.folder\' : \'sample-folder/\''"
class="file-upload-ik">
</ik-upload>
<button (click)="onAbortFunction()">Abort</button>
Expand Down
Loading