Skip to content

Commit 02751f3

Browse files
committed
docs: enhance README with detailed SDK initialization and transformation usage
1 parent b9e554d commit 02751f3

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ And include it in your HTML:
6161

6262
## Initialization
6363

64-
Initialize the SDK with your URL endpoint. For URL generation:
64+
Initialize the SDK by specifying your URL endpoint. You can obtain your URL endpoint from [https://imagekit.io/dashboard/url-endpoints](https://imagekit.io/dashboard/url-endpoints) and your public API key from [https://imagekit.io/dashboard/developer/api-keys](https://imagekit.io/dashboard/developer/api-keys). For URL generation:
6565
```js
6666
var imagekit = new ImageKit({
6767
urlEndpoint: "https://ik.imagekit.io/your_imagekit_id"
@@ -201,16 +201,20 @@ var imageURL = imagekit.url({
201201

202202
### Supported Transformations
203203

204-
The SDK supports various transformations which are translated to URL parameters as follows:
204+
The SDK gives a name to each transformation parameter e.g. height for h and width for w parameter. It makes your code more readable. If the property does not match any of the following supported options, it is added as it is.
205+
206+
If you want to generate transformations in your application and add them to the URL as it is, use the raw parameter.
207+
208+
Check ImageKit [transformation documentation](https://imagekit.io/docs/transformations) for more details.
205209

206210
| Transformation Name | URL Parameter |
207211
| -------------------------- | ------------------------------------------------------------- |
208212
| width | w |
209213
| height | h |
210214
| aspectRatio | ar |
211215
| quality | q |
212-
| aiRemoveBackground | e-bgremove |
213-
| aiRemoveBackgroundExternal | e-removedotbg |
216+
| aiRemoveBackground | e-bgremove (ImageKit powered) |
217+
| aiRemoveBackgroundExternal | e-removedotbg (Using third party) |
214218
| aiUpscale | e-upscale |
215219
| aiRetouch | e-retouch |
216220
| aiVariation | e-genvar |
@@ -246,6 +250,7 @@ The SDK supports various transformations which are translated to URL parameters
246250
| sharpen | e-sharpen |
247251
| unsharpMask | e-usm |
248252
| gradient | e-gradient |
253+
| flip | fl |
249254
| opacity | o |
250255
| zoom | z |
251256
| page | pg |
@@ -254,12 +259,22 @@ The SDK supports various transformations which are translated to URL parameters
254259
| duration | du |
255260
| streamingResolutions | sr |
256261
| raw | The string provided in raw will be added in the URL as it is. |
257-
| flip | fl |
258262

259263
### Handling Unsupported Transformations
260264

261265
If you specify a transformation parameter that is not explicitly supported by the SDK, it is added “as-is” in the generated URL. This provides flexibility for using new or custom transformations without waiting for an SDK update.
262266

267+
For example:
268+
```js
269+
var imageURL = imagekit.url({
270+
path: "/test_path.jpg",
271+
transformation: [{
272+
"newparam": "cool"
273+
}]
274+
});
275+
// Generated URL: https://ik.imagekit.io/test_url_endpoint/tr:newparam-cool/test_path.jpg
276+
```
277+
263278
## File Upload
264279

265280
The SDK offers a simple interface via the `.upload()` method to upload files to the ImageKit Media Library. This method requires the following:

0 commit comments

Comments
 (0)