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
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,8 +62,8 @@ ImageKitIo.configure do |config|
62
62
end
63
63
```
64
64
#### CarrierWave
65
-
You can create a carrierwave uploader in order to attach pictures to your database objects as their attributes. To upload images without designating them as database attributes, skip to [this section](https://github.com/imagekit-developer/imagekit-ruby#file-upload).
66
-
(make sure to add service `:carrierwave` as shown in [initialization section](#Initialization))
65
+
You can create a CarrierWave uploader to attach pictures to your database objects as their attributes. Skip to [this section](https://github.com/imagekit-developer/imagekit-ruby#file-upload) to upload images without designating them as database attributes. Make sure to add service `:carrierwave` as shown in [initialization section](#initialization).
66
+
67
67
```bash
68
68
rails g uploader <Uploading_attribute_name>
69
69
# For example, if you want to create an uploader for Avatar attribute, then use
@@ -137,7 +137,7 @@ Get image url:
137
137
@employee.avatar.url
138
138
```
139
139
140
-
Now lets configure active_storage as a service for the imagekitio.
140
+
Now, let's configure active_storage as a service for the imagekitio.
141
141
142
142
First add `:active_storage` in initializer file.
143
143
@@ -155,7 +155,7 @@ imagekitio:
155
155
156
156
## Usage
157
157
158
-
You can use this Ruby SDK for three different kinds of methods - URL generation, file upload, and file management.
158
+
You can use this Ruby SDK for three different methods - URL generation, file upload, and file management.
This method allows you to add transformation parameters to an existing, complete URL that is already mapped to ImageKit
189
-
using `src` parameter. This method should be used if you have the complete image URL mapped to ImageKit stored in your
188
+
This method allows you to add transformation parameters to an existing, complete URL already mapped to ImageKit using the `src` parameter. This method should be used if you have the complete image URL mapped to ImageKit stored in your
190
189
database.
191
190
192
191
@@ -213,7 +212,7 @@ The `.url()` method accepts the following parameters
213
212
| src | Conditional. 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. |
214
213
| transformation | Optional. 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. |
215
214
| transformation_position | Optional. The 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 `src` parameter to create the URL, then the transformation string is always added as a query parameter. |
216
-
| query_parameters | Optional. 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. |
215
+
| query_parameters | Optional. 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. |
217
216
| signed | Optional. 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. |
218
217
| expire_seconds | Optional. 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).
291
290
The SDK gives a name to each transformation parameter, making the code simpler, making the code simpler, and readable.
292
-
If a transformation is supported in ImageKit, but a name for it cannot be found in the table below, then use the
293
-
transformation code from ImageKit docs as the name when using the `url` function.
291
+
292
+
If a transformation is supported in ImageKit, but a name for it cannot be found in the table below, then use the transformation code from ImageKit docs as the name when using the `url` function.
293
+
294
+
If you want to generate transformations in your application and add them to the URL as it is, use the `raw` parameter.
294
295
295
296
| Supported Transformation Name | Translates to parameter |
Add multiple tags on multiple files using array of file ids and array of tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/add-tags-bulk)
514
+
Add multiple tags on multiple files using an array of file ids and an array of tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/add-tags-bulk)
514
515
515
516
```ruby
516
517
imagekitio.add_bulk_tags(
@@ -521,7 +522,7 @@ imagekitio.add_bulk_tags(
521
522
522
523
**13. Delete Bulk Tags**
523
524
524
-
Remove multiple tags from multiple files using array of file ids and array of tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/remove-tags-bulk)
525
+
Remove multiple tags from multiple files using an array of file ids and an array of tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/remove-tags-bulk)
525
526
526
527
```ruby
527
528
imagekitio.delete_bulk_tags(
@@ -651,7 +652,7 @@ We have included the following commonly used utility functions in this package.
651
652
652
653
**Authentication parameter generation**
653
654
654
-
In case you are looking to implement client-side file upload, you are going to need a `token`, `expiry` timestamp, and a valid `signature` for that upload. The SDK provides a simple method that you can use in your code to generate these authentication parameters for you.
655
+
If you are looking to implement client-side file upload, you will need a `token`, `expiry` timestamp, and a valid `signature` for that upload. The SDK provides a simple method that you can use in your code to generate these authentication parameters for you.
655
656
656
657
_Note: The Private API Key should never be exposed in any client-side code. You must always generate these authentication parameters on the server-side_
657
658
@@ -677,7 +678,7 @@ value of an image in the response. You can use this value to find a duplicate ne
677
678
the distance between the two images.
678
679
679
680
680
-
This SDK exposes the `phash_distance` function to calculate the distance between two pHash value. It accepts two pHash hexadecimal
681
+
This SDK exposes the `phash_distance` function to calculate the distance between two pHash values. It accepts two pHash hexadecimal
681
682
strings and returns a numeric value indicative of the level of difference between the two images.
0 commit comments