imagekitio 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +112 -37
- data/lib/active_storage/service/ik_file.rb +4 -0
- data/lib/imagekitio/api_service/file.rb +1 -0
- data/lib/imagekitio/constants/file.rb +1 -1
- data/lib/imagekitio/constants/supported_transformation.rb +2 -27
- data/lib/imagekitio/sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aa3937bea9d3b4ff1bbc6a5f7bde28eeee0de07c423ed5daf702f2bbcba00ff
|
4
|
+
data.tar.gz: 3b83ee3b6a677905be5f03eb7023c53495fb0b79c7f623e5f8844fffd48d74c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 548b8b9820cea02e34a10d939c962af956fe54a25027d69c8362153a33ef936db770520b4522947cfd0fa7a7003af308c2f4eef9b39286406ea1b2a70ec3a1e0
|
7
|
+
data.tar.gz: cfa61aefd6ec06f1b6b246cff9a36aebb8315dc1b9fd0b40c0f8ab595ff3060010c6df64780a707d65246de7af1ad3b44bdf07cf083c991ebfb1472f3bb3ee6a
|
data/README.md
CHANGED
@@ -13,6 +13,7 @@ Ruby on Rails gem for [ImageKit](https://imagekit.io/) implements the new APIs a
|
|
13
13
|
ImageKit is complete media storage, optimization, and transformation solution that comes with an [image and video CDN](https://imagekit.io/features/imagekit-infrastructure). 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.
|
14
14
|
|
15
15
|
Table of contents -
|
16
|
+
* [Changelog](#changelog)
|
16
17
|
* [Installation](#installation)
|
17
18
|
* [Initialization](#initialization)
|
18
19
|
- [CarrierWave](#carrierwave)
|
@@ -28,7 +29,14 @@ Table of contents -
|
|
28
29
|
|
29
30
|
|
30
31
|
# Quick start guide
|
31
|
-
Get started with [official quick start guide](https://docs.imagekit.io/getting-started/quickstart-guides/ruby-
|
32
|
+
Get started with [official quick start guide](https://docs.imagekit.io/getting-started/quickstart-guides/ruby-guides) for integrating ImageKit in Ruby on Rails.
|
33
|
+
|
34
|
+
## Changelog
|
35
|
+
### SDK Version 3.0.0
|
36
|
+
#### Breaking changes
|
37
|
+
**1. Overlay syntax update**
|
38
|
+
* In version 3.0.0, we've removed the old overlay syntax parameters for transformations, such as `oi`, `ot`, `obg`, and [more](https://docs.imagekit.io/features/image-transformations/overlay). These parameters are deprecated and will start returning errors when used in URLs. Please migrate to the new layers syntax that supports overlay nesting, provides better positional control, and allows more transformations at the layer level. You can start with [examples](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#examples) to learn quickly.
|
39
|
+
* You can migrate to the new layers syntax using the `raw` transformation parameter.
|
32
40
|
|
33
41
|
## Installation
|
34
42
|
|
@@ -282,6 +290,99 @@ image_url = imagekit.url({
|
|
282
290
|
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400/default-image.jpg?v=123&ik-t=1567358667&ik-s=f2c7cdacbe7707b71a83d49cf1c6110e3d701054
|
283
291
|
```
|
284
292
|
|
293
|
+
**4. Adding overlays**
|
294
|
+
|
295
|
+
ImageKit.io enables you to apply overlays to [images](https://docs.imagekit.io/features/image-transformations/overlay-using-layers) and [videos](https://docs.imagekit.io/features/video-transformation/overlay) using the raw parameter with the concept of [layers](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#layers). The raw parameter facilitates incorporating transformations directly in the URL. A layer is a distinct type of transformation that allows you to define an asset to serve as an overlay, along with its positioning and additional transformations.
|
296
|
+
|
297
|
+
**Text as overlays**
|
298
|
+
|
299
|
+
You can add any text string over a base video or image using a text layer (l-text).
|
300
|
+
|
301
|
+
For example:
|
302
|
+
|
303
|
+
```ruby
|
304
|
+
image_url = imagekit.url({
|
305
|
+
path: "/default-image",
|
306
|
+
url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",
|
307
|
+
transformation: [{
|
308
|
+
height: "300",
|
309
|
+
width: "400",
|
310
|
+
raw: "l-text,i-Imagekit,fs-50,l-end"
|
311
|
+
}],
|
312
|
+
})
|
313
|
+
```
|
314
|
+
**Sample Result URL**
|
315
|
+
```
|
316
|
+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-text,i-Imagekit,fs-50,l-end/default-image.jpg
|
317
|
+
```
|
318
|
+
|
319
|
+
**Image as overlays**
|
320
|
+
|
321
|
+
You can add an image over a base video or image using an image layer (l-image).
|
322
|
+
|
323
|
+
For example:
|
324
|
+
|
325
|
+
```ruby
|
326
|
+
image_url = imagekit.url({
|
327
|
+
path: "/default-image",
|
328
|
+
url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",
|
329
|
+
transformation: [{
|
330
|
+
height: "300",
|
331
|
+
width: "400",
|
332
|
+
raw: "l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end"
|
333
|
+
}],
|
334
|
+
})
|
335
|
+
```
|
336
|
+
**Sample Result URL**
|
337
|
+
```
|
338
|
+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end/default-image.jpg
|
339
|
+
```
|
340
|
+
|
341
|
+
**Solid color blocks as overlays**
|
342
|
+
|
343
|
+
You can add solid color blocks over a base video or image using an image layer (l-image).
|
344
|
+
|
345
|
+
For example:
|
346
|
+
|
347
|
+
```ruby
|
348
|
+
image_url = imagekit.url({
|
349
|
+
path: "/img/sample-video",
|
350
|
+
url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",
|
351
|
+
transformation: [{
|
352
|
+
height: "300",
|
353
|
+
width: "400",
|
354
|
+
raw: "l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end"
|
355
|
+
}],
|
356
|
+
})
|
357
|
+
```
|
358
|
+
**Sample Result URL**
|
359
|
+
```
|
360
|
+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end/img/sample-video.mp4
|
361
|
+
```
|
362
|
+
|
363
|
+
**5. Arithmetic expressions in transformations**
|
364
|
+
|
365
|
+
ImageKit allows use of [arithmetic expressions](https://docs.imagekit.io/features/arithmetic-expressions-in-transformations) in certain dimension and position-related parameters, making media transformations more flexible and dynamic.
|
366
|
+
|
367
|
+
For example:
|
368
|
+
|
369
|
+
```ruby
|
370
|
+
image_url = imagekit.url({
|
371
|
+
path: "/default-image.jpg",
|
372
|
+
url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",
|
373
|
+
transformation: [{
|
374
|
+
width: "iw_div_4",
|
375
|
+
height: "ih_div_2",
|
376
|
+
border: "cw_mul_0.05_yellow"
|
377
|
+
}]
|
378
|
+
});
|
379
|
+
```
|
380
|
+
|
381
|
+
**Sample Result URL**
|
382
|
+
```
|
383
|
+
https://ik.imagekit.io/your_imagekit_id/default-image.jpg?tr=w-iw_div_4,h-ih_div_2,b-cw_mul_0.05_yellow
|
384
|
+
```
|
385
|
+
|
285
386
|
**List of transformations**
|
286
387
|
|
287
388
|
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). The SDK gives a name to each transformation parameter, making the code simpler, making the code simpler, and readable.
|
@@ -294,10 +395,10 @@ If you want to generate transformations in your application and add them to the
|
|
294
395
|
|-------------------------------|-------------------------|
|
295
396
|
| height | h |
|
296
397
|
| width | w |
|
297
|
-
|
|
398
|
+
| aspect_ratio | ar |
|
298
399
|
| quality | q |
|
299
400
|
| crop | c |
|
300
|
-
|
|
401
|
+
| crop_mode | cm |
|
301
402
|
| x | x |
|
302
403
|
| y | y |
|
303
404
|
| focus | fo |
|
@@ -308,45 +409,19 @@ If you want to generate transformations in your application and add them to the
|
|
308
409
|
| rotation | rt |
|
309
410
|
| blur | bl |
|
310
411
|
| named | n |
|
311
|
-
| overlayX | ox |
|
312
|
-
| overlayY | oy |
|
313
|
-
| overlayFocus | ofo |
|
314
|
-
| overlayHeight | oh |
|
315
|
-
| overlayWidth | ow |
|
316
|
-
| overlayImage | oi |
|
317
|
-
| overlayImageTrim | oit |
|
318
|
-
| overlayImageAspectRatio | oiar |
|
319
|
-
| overlayImageBackground | oibg |
|
320
|
-
| overlayImageBorder | oib |
|
321
|
-
| overlayImageDPR | oidpr |
|
322
|
-
| overlayImageQuality | oiq |
|
323
|
-
| overlayImageCropping | oic |
|
324
|
-
| overlayImageTrim | oit |
|
325
|
-
| overlayText | ot |
|
326
|
-
| overlayTextFontSize | ots |
|
327
|
-
| overlayTextFontFamily | otf |
|
328
|
-
| overlayTextColor | otc |
|
329
|
-
| overlayTextTransparency | oa |
|
330
|
-
| overlayAlpha | oa |
|
331
|
-
| overlayTextTypography | ott |
|
332
|
-
| overlayBackground | obg |
|
333
|
-
| overlayTextEncoded | ote |
|
334
|
-
| overlayTextWidth | otw |
|
335
|
-
| overlayTextBackground | otbg |
|
336
|
-
| overlayTextPadding | otp |
|
337
|
-
| overlayTextInnerAlignment | otia |
|
338
|
-
| overlayRadius | or |
|
339
412
|
| progressive | pr |
|
340
413
|
| lossless | lo |
|
341
414
|
| trim | t |
|
342
415
|
| metadata | md |
|
343
|
-
|
|
344
|
-
|
|
416
|
+
| color_profile | cp |
|
417
|
+
| default_image | di |
|
345
418
|
| dpr | dpr |
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
419
|
+
| effect_sharpen | e-sharpen |
|
420
|
+
| effect_usm | e-usm |
|
421
|
+
| effect_contrast | e-contrast |
|
422
|
+
| effect_gray | e-grayscale |
|
423
|
+
| effect_shadow | e-shadow |
|
424
|
+
| effect_gradient | e-gradient |
|
350
425
|
| original | orig |
|
351
426
|
| raw | `replaced by the parameter value` |
|
352
427
|
|
@@ -36,6 +36,7 @@ module ImageKitIo
|
|
36
36
|
content_type = options.delete(:content_type) || ''
|
37
37
|
options = format_to_json(options, :extensions, Array)
|
38
38
|
options = format_to_json(options, :custom_metadata, Hash)
|
39
|
+
options = format_to_json(options, :transformation, Hash)
|
39
40
|
options = validate_upload_options(options || {})
|
40
41
|
if options.is_a?(FalseClass)
|
41
42
|
raise ArgumentError, "Invalid Upload option"
|
@@ -5,7 +5,7 @@ module ImageKitIo
|
|
5
5
|
|
6
6
|
VALID_FILE_DETAIL_OPTIONS = ["fileID"]
|
7
7
|
|
8
|
-
VALID_UPLOAD_OPTIONS = %w[file file_name use_unique_file_name tags folder is_private_file custom_coordinates response_fields extensions webhook_url overwrite_file overwrite_AI_tags overwrite_custom_metadata custom_metadata mime overwrite_tags content_type
|
8
|
+
VALID_UPLOAD_OPTIONS = %w[file file_name use_unique_file_name tags folder is_private_file custom_coordinates response_fields extensions webhook_url overwrite_file overwrite_AI_tags overwrite_custom_metadata custom_metadata mime overwrite_tags content_type transformation ]
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -18,33 +18,6 @@ module ImageKitIo
|
|
18
18
|
'rotation': "rt",
|
19
19
|
'blur': "bl",
|
20
20
|
'named': "n",
|
21
|
-
'overlay_image': "oi",
|
22
|
-
'overlay_image_trim': "oit",
|
23
|
-
'overlay_image_cropping': "oic",
|
24
|
-
'overlay_image_quality': "oiq",
|
25
|
-
'overlay_image_DPR': "oidpr",
|
26
|
-
'overlay_image_border': "oib",
|
27
|
-
'overlay_image_background': "oibg",
|
28
|
-
'overlay_image_aspect_ratio': "oiar",
|
29
|
-
'overlay_x': "ox",
|
30
|
-
'overlay_y': "oy",
|
31
|
-
'overlay_focus': "ofo",
|
32
|
-
'overlay_height': "oh",
|
33
|
-
'overlay_width': "ow",
|
34
|
-
'overlay_text': "ot",
|
35
|
-
'overlay_text_font_size': "ots",
|
36
|
-
'overlay_text_font_family': "otf",
|
37
|
-
'overlay_text_encoded': "ote",
|
38
|
-
'overlay_text_color': "otc",
|
39
|
-
'overlay_text_width': "otw",
|
40
|
-
'overlay_text_background': "otbg",
|
41
|
-
'overlay_text_padding': "otp",
|
42
|
-
'overlay_text_inner_alignment': "otia",
|
43
|
-
'overlay_text_transparency': "oa",
|
44
|
-
'overlay_alpha': "oa",
|
45
|
-
'overlay_radius': "or",
|
46
|
-
'overlay_text_typography': "ott",
|
47
|
-
'overlay_background': "obg",
|
48
21
|
'progressive': "pr",
|
49
22
|
'lossless': "lo",
|
50
23
|
'trim': "t",
|
@@ -56,6 +29,8 @@ module ImageKitIo
|
|
56
29
|
'effect_usm': "e-usm",
|
57
30
|
'effect_contrast': "e-contrast",
|
58
31
|
'effect_gray': "e-grayscale",
|
32
|
+
'effect_shadow': "e-shadow",
|
33
|
+
'effect_gradient': "e-gradient",
|
59
34
|
'original': "orig",
|
60
35
|
'raw': 'raw',
|
61
36
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imagekitio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ImageKit.io team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|