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
@@ -55,7 +54,7 @@ Step 1. Add the JitPack repository to your build file
55
54
</repository>
56
55
</repositories>
57
56
```
58
-
Step 2. Add the dependency in POM file:
57
+
Step 2. Add the dependency in the POM file:
59
58
```
60
59
<dependency>
61
60
<groupId>com.github.imagekit-developer</groupId>
@@ -66,15 +65,15 @@ Step 2. Add the dependency in POM file:
66
65
67
66
## Initialization
68
67
69
-
Step 1. Create a `config.properties` file inside `src/main/resources` of your project. And put essential values of keys [UrlEndpoint, PrivateKey, PublicKey], no need to use quote(`'` or `"`) in values.
68
+
**Step 1**. Create a `config.properties` file inside `src/main/resources` of your project. And put essential values of keys [UrlEndpoint, PrivateKey, PublicKey], no need to use quote(`'` or `"`) in values.
70
69
71
70
```editorconfig
72
71
# Put essential values of keys [UrlEndpoint, PrivateKey, PublicKey]
73
72
UrlEndpoint=<-YOUR-ENDPOINT-URL-HERE->
74
73
PrivateKey=<-YOUR-PRIVATE-KEY-HERE->
75
74
PublicKey=<-YOUR-PUBLIC-KEY-HERE->
76
75
```
77
-
Step 2. Then you need to initialize ImageKit with that configuration.
76
+
**Step 2**. Then you need to initialize ImageKit with that configuration.
78
77
79
78
```java
80
79
importio.imagekit.sdk.ImageKit;
@@ -110,47 +109,44 @@ You can use this Java SDK for 3 different kinds of methods:
110
109
* URL generation
111
110
* file upload
112
111
* file management
113
-
*
112
+
114
113
The usage of the SDK has been explained below.
115
114
116
115
## Change log
117
-
This document presents a list of changes that break existing functionality of previous versions. We try our best to minimize these disruptions, but sometimes they are unavoidable and they will be in major versions.
116
+
This document presents a list of changes that break the existing functionality of previous versions. We try our best to minimize these disruptions, but sometimes they are unavoidable and will be in major versions.
118
117
119
118
### Breaking History:
120
119
121
120
Changes from 1.0.3 -> 2.0.0 are listed below
122
121
123
-
1. Result object raw and getMap() properties:
122
+
1. Result raw object and getMap() properties:
124
123
125
124
**What changed**
126
125
- raw and getMap() has been deprecated.
127
126
128
127
**Who is affected?**
129
-
- This affects any development that uses the raw or getMap() from response object of APIs that is Result object.
128
+
- This affects any development that uses the raw or getMap() from the response object of APIs and Result object.
130
129
131
130
**How should I update my code?**
132
-
- If you still need to use raw and getMap(), write it with using it with result's internal property such as result.getResponseMetaData().getRaw().
131
+
- If you still need to use raw and getMap(), do this `result.getResponseMetaData().getRaw()`.
133
132
134
133
2. Result object message and isSuccessful boolean properties:
135
134
136
135
**What changed**
137
-
- message and isSuccessful has been replaced with custom exceptions according to response code.
136
+
- message and isSuccessful have been replaced with custom exceptions according to response code.
138
137
139
138
**Who is affected?**
140
139
- This affects any development that uses the message or isSuccessful from response object of APIs that is Result object.
141
140
142
141
**How should I update my code?**
143
-
- If you still need to use message it will be there in custom exception and could be raised isSuccessful properties in your own code from status code which is coming in the response or custom exception.
142
+
- If you still need to use message it will be there in the custom exception and could be raised isSuccessful properties in your own code from status code that is coming in the response or custom exception.
144
143
145
144
146
145
## URL generation
147
146
148
147
**1. Using image path and URL-endpoint**
149
148
150
-
This method allows you to create a URL using the path where the image exists and the URL-endpoint you want to use to access the image. You can refer to the documentation
151
-
[here](https://docs.imagekit.io/integration/url-endpoints) to read more about URL endpoints
152
-
in ImageKit and the section about [image origins](https://docs.imagekit.io/integration/configure-origin) to understand
153
-
about paths with different kinds of origins.
149
+
This method allows you to create an URL to access a file using the relative file path and the ImageKit URL endpoint (`urlEndpoint`). The file can be an image, video, or any other static file supported by ImageKit.
This method allows you to add transformation parameters to an existing complete URL that is already mapped to ImageKit
180
-
using the `src` parameter. This method should be used if you have the complete image URL mapped to ImageKit stored in your
181
-
database.
175
+
This method allows you to add transformation parameters to an absolute URL. For example, if you have configured a custom CNAME and have absolute asset URLs in your database or CMS, you will often need this.
| urlEndpoint | Optional. `(Type: String)` The base URL to be appended before the path of the image. If not specified, the URL Endpoint specified at the time of SDK initialization is used. For example, https://ik.imagekit.io/your_imagekit_id/|
202
+
| urlEndpoint | Optional. `(Type: String)` The base URL to be appended before the path of the image. If not specified, the URL Endpoint specified during SDK initialization is used. For example, https://ik.imagekit.io/your_imagekit_id/|
209
203
| path | Conditional. `(Type: String)` This is the path at which the image exists. For example, `/path/to/image.jpg`. Either the `path` or `src` parameter needs to be specified for URL generation. |
210
204
| src | Conditional. `(Type: String)` This is the complete URL of an image already mapped to ImageKit. For example, `https://ik.imagekit.io/your_imagekit_id/endpoint/path/to/image.jpg`. Either the `path` or `src` parameter needs to be specified for URL generation. |
211
205
| transformation | Optional. `(Type: List<Map<String,String>>)` An array of objects specifying the transformation to be applied in the URL. The transformation name and the value should be specified as a key-value pair in the object. Different steps of a [chained transformation](https://docs.imagekit.io/features/image-transformations/chained-transformations) can be specified as different objects of the array. The complete list of supported transformations in the SDK and some examples of using them are given later. If you use a transformation name that is not specified in the SDK, it gets applied as it is in the URL. |
212
-
| transformationPosition | Optional. `(Type: String)` Default value is `path` that places the transformation string as a path parameter in the URL. It can also be specified as `query` which adds the transformation string as the query parameter `tr` in the URL. If you use the `src` parameter to create the URL, then the transformation string is always added as a query parameter. |
213
-
| queryParameters | Optional. `(Type: Map<String, String>)` These are the other query parameters that you want to add to the final URL. These can be any query parameters and not necessarily related to ImageKit. Especially useful if you want to add some versioning parameter to your URLs. |
214
-
| signed | Optional. `(Type: Boolean)` Default is `false`. If set to `true`, the SDK generates a signed image URL adding the image signature to the image URL. This can only be used if you are creating the URL with the `url_endpoint` and `path` parameters, and not with the `src` parameter. |
206
+
| transformationPosition | Optional. `(Type: String)` Default value is `path` that places the transformation string as a path parameter in the URL. It can also be specified as `query`, which adds the transformation string as the query parameter `tr` in the URL. If you use the `src` parameter to create the URL, then the transformation string is always added as a query parameter. |
207
+
| queryParameters | Optional. `(Type: Map<String, String>)` These are the other query parameters that you want to add to the final URL. These can be any query parameters and not necessarily related to ImageKit. Especially useful if you want to add some versioning parameters to your URLs. |
208
+
| signed | Optional. `(Type: Boolean)` Default is `false`. If set to `true`, the SDK generates a signed image URL adding the image signature to the image URL. This can only be used if you create the URL with the `url_endpoint` and `path` parameters and not with the `src` parameter. |
215
209
| expireSeconds | Optional. `(Type: Integer)` Meant to be used along with the `signed` parameter to specify the time in seconds from now when the URL should expire. If specified, the URL contains the expiry timestamp in the URL, and the image signature is modified accordingly. |
The complete list of transformations supported and their usage in ImageKit can be found [here](https://docs.imagekit.io/features/image-transformations/resize-crop-and-other-transformations).
296
-
The SDK gives a name to each transformation parameter, making the code simpler, making the code more straightforward and readable.
297
-
If a transformation is supported in ImageKit, but a name for it cannot be found in the table below, then use the
298
-
transformation code from ImageKit docs as the name when using in the ```url``` function.
289
+
See the complete list of [image](https://docs.imagekit.io/features/image-transformations) and [video](https://docs.imagekit.io/features/video-transformation) transformations supported in ImageKit. 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.
299
290
291
+
If you want to generate transformations in your application and add them to the URL as it is, use the `raw` parameter.
300
292
301
293
| Supported Transformation Name | Translates to parameter |
@@ -362,12 +354,9 @@ transformation code from ImageKit docs as the name when using in the ```url``` f
362
354
## File Upload
363
355
364
356
The SDK provides a simple interface using the `.upload()` method to upload files to the ImageKit Media library. It
365
-
accepts an object of `FileCreateRequest` class that contains all the parameters supported by the [ImageKit Upload API](https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload).
357
+
accepts an object of the `FileCreateRequest` class that contains all the parameters supported by the [ImageKit Upload API](https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload).
366
358
367
-
The constructor `FileCreateRequest` class requires `file` as (URL/Base64/Byte Array) and `file_name` if `file` is byte array then it's require another parameter named `mediaType` to upload a file. The method returns object of `Result` class. It contains method `isSuccessful()` (return boolean), `getMessage()` for error message and other file parameter responsed by server.
368
-
ImageKit upload API using the same parameter name as specified in the upload API documentation. For example, to
369
-
specify tags for a file at the time of upload use the tags parameter as specified in the
The constructor `FileCreateRequest` class requires `file` as (URL/Base64/Byte Array) and `file_name`. If `file` is byte array then it's require another parameter named `mediaType` to upload a file. The method returns object of `Result` class. It contains method `isSuccessful()` (return boolean), `getMessage()` for error message and other file parameter responsed by server.
If the upload is successful, `getMessage()` will be `None`, and the result will be an object of `Result` class that contains the same all the parameters received from ImageKit's servers and `isSuccessful()` will return true.
409
+
If the upload is successful, `getMessage()` will be `None`, and the result will be an object of `Result` class that contains the same all the parameters received from ImageKit's servers, and `isSuccessful()` will return true.
421
410
422
-
If the upload fails, `getMessage()` will contain the same error message received from ImageKit's servers and `isSuccessful()` will return false.
411
+
If the upload fails, `getMessage()` will contain the same error message received from ImageKit's servers, and `isSuccessful()` will return false.
423
412
424
413
425
414
## File Management
426
415
427
-
The SDK provides a simple interface for all the [media APIs mentioned here](https://docs.imagekit.io/api-reference/media-api)
428
-
to manage your files. This also returns `error` and `result`, the error will be `None` if API succeeds.
416
+
The SDK provides a simple interface for all the [media APIs mentioned here](https://docs.imagekit.io/api-reference/media-api) to manage your files. This also returns `error` and `result`, the error will be `None` if API succeeds.
429
417
430
418
**1. List & Search Files**
431
419
432
-
Accepts an object specifying the parameters to be used to list and search files. All parameters specified
433
-
in the [documentation here](https://docs.imagekit.io/api-reference/media-api/list-and-search-files) can be passed as-is with the
434
-
correct values to get the results.
420
+
Accepts an object specifying the parameters to be used to list and search files. All parameters specified in the [documentation here](https://docs.imagekit.io/api-reference/media-api/list-and-search-files) can be passed as-is with the correct values to get the results.
0 commit comments