Skip to content

Commit 000e702

Browse files
authored
Merge pull request #64 from imagekit-developer/SDK-94
added effectShadow and effectGradient prameters
2 parents 6bf6085 + 13520f1 commit 000e702

File tree

11 files changed

+415
-713
lines changed

11 files changed

+415
-713
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ImageKit is complete media storage, optimization, and transformation solution th
1010
- [Key Features](#key-features)
1111
- [Requirements](#requirements)
1212
- [Version Support](#version-support)
13+
- [Breaking changes](#breaking-changes)
1314
- [Installation](#installation)
1415
- [Usage](#usage)
1516
- [Getting Started](#getting-started)
@@ -44,10 +45,20 @@ ImageKit is complete media storage, optimization, and transformation solution th
4445
## Version Support
4546
| SDK Version | PHP 5.4 | PHP 5.5 | PHP 5.6 | PHP 7.x | PHP 8.x |
4647
|-------------|---------|---------|---------|---------|---------|
48+
| 4.x ||| ✔️ | ✔️ |✔️ |
4749
| 3.x ||| ✔️ | ✔️ |✔️ |
4850
| 2.x ||| ✔️ | ✔️ |✔️ |
4951
| 1.x || ✔️ | ✔️ | ✔️ |✔️ |
5052

53+
## Breaking changes
54+
55+
### Upgrading from 3.x to 4.x version
56+
57+
1. Overlay syntax update
58+
59+
* In version 4.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.
60+
* You can migrate to the new layers syntax using the `raw` transformation parameter.
61+
5162
## Installation
5263

5364
You can install the bindings via [Composer](http://getcomposer.org/). Run the following command:
@@ -441,7 +452,32 @@ $imageURL = $imageKit->url(array(
441452
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
442453
```
443454

444-
### 6. Signed URL
455+
### 6. Arithmetic expressions in transformations
456+
457+
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.
458+
459+
For example:
460+
461+
```php
462+
$imageURL = $imageKit->url(array(
463+
'path' => '/default-image.jpg',
464+
'urlEndpoint' => 'https://ik.imagekit.io/your_imagekit_id'
465+
'transformation' => [
466+
[
467+
"height": "ih_div_2",
468+
"width": "iw_div_4",
469+
"border": "cw_mul_0.05_yellow"
470+
]
471+
]
472+
));
473+
```
474+
475+
#### Sample Result URL
476+
```
477+
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
478+
``
479+
480+
### 7. Signed URL
445481
446482
For example, the signed URL expires in 300 seconds with the default URL endpoint and other query parameters.
447483
For a detailed explanation of the signed URL, refer to this [documentation](https://docs.imagekit.io/features/security/signed-urls).
@@ -508,6 +544,8 @@ If you want to generate transformations in your application and add them to the
508544
| effectUSM | e-usm |
509545
| effectContrast | e-contrast |
510546
| effectGray | e-grayscale |
547+
| effectShadow | e-shadow |
548+
| effectGradient | e-gradient |
511549
| original | orig |
512550
| raw | `replaced by the parameter value` |
513551

@@ -610,6 +648,15 @@ $uploadFile = $imageKit->uploadFile([
610648
"overwriteAITags" => true, // set to false in order to preserve overwriteAITags
611649
"overwriteTags" => true,
612650
"overwriteCustomMetadata" => true,
651+
'transformation' => [
652+
'pre' => 'l-text,i-Imagekit,fs-50,l-end',
653+
'post' => [
654+
[
655+
'type' => 'transformation',
656+
'value' => 'h-100'
657+
]
658+
]
659+
],
613660
// "customMetadata" => [
614661
// "SKU" => "VS882HJ2JD",
615662
// "price" => 599.99,

sample/upload_api/index.php

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@
1818
'folder' => 'sample-folder',
1919
'tags' => implode(['abd', 'def']),
2020
'useUniqueFileName' => false,
21-
'customCoordinates' => implode(',', ['10', '10', '100', '100'])
21+
'customCoordinates' => implode(',', ['10', '10', '100', '100']),
22+
'transformation' => [
23+
'pre' => 'l-text,i-Imagekit,fs-50,l-end',
24+
'post' => [
25+
[
26+
'type' => 'transformation',
27+
'value' => 'h-100'
28+
]
29+
]
30+
],
2231
]);
2332

2433
echo "\n\n";
@@ -34,7 +43,16 @@
3443
'folder' => 'sample-folder',
3544
'tags' => implode(['abd', 'def']),
3645
'useUniqueFileName' => true,
37-
'customCoordinates' => implode(',', ['10', '10', '100', '100'])
46+
'customCoordinates' => implode(',', ['10', '10', '100', '100']),
47+
'transformation' => [
48+
'pre' => 'l-text,i-Imagekit,fs-50,l-end',
49+
'post' => [
50+
[
51+
'type' => 'transformation',
52+
'value' => 'h-100'
53+
]
54+
]
55+
],
3856
]);
3957

4058
echo "\n\n";
@@ -51,7 +69,16 @@
5169
'folder' => 'sample-folder',
5270
'tags' => implode(['abd', 'def']),
5371
'useUniqueFileName' => true,
54-
'customCoordinates' => implode(',', ['10', '10', '100', '100'])
72+
'customCoordinates' => implode(',', ['10', '10', '100', '100']),
73+
'transformation' => [
74+
'pre' => 'l-text,i-Imagekit,fs-50,l-end',
75+
'post' => [
76+
[
77+
'type' => 'transformation',
78+
'value' => 'h-100'
79+
]
80+
]
81+
],
5582
]);
5683

5784
echo "\n\n";

sample/url_generation/image_enhancement_and_color_manipulation.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,43 @@
6363
echo "3. Unsharp mask Image URL: \n";
6464
echo "\033[01;32m$imageURL\033[0m";
6565
echo "\n";
66+
67+
// Shadow (e-shadow)
68+
// https://docs.imagekit.io/features/image-transformations/image-enhancement-and-color-manipulation#shadow-e-shadow
69+
70+
$imageURL = $imageKit->url(
71+
[
72+
'src' => 'https://ik.imagekit.io/demo/sample_image.jpg',
73+
'transformation' => [
74+
[
75+
'height' => '300',
76+
'effectShadow' => 'bl-15_st-40_x-10_y-N5'
77+
]
78+
],
79+
]
80+
);
81+
82+
echo "\n\n";
83+
echo "4. Shadow image URL: \n";
84+
echo "\033[01;32m$imageURL\033[0m";
85+
echo "\n";
86+
87+
// Gradient (e-gradient)
88+
// https://docs.imagekit.io/features/image-transformations/image-enhancement-and-color-manipulation#gradient-e-gradient
89+
90+
$imageURL = $imageKit->url(
91+
[
92+
'src' => 'https://ik.imagekit.io/demo/sample_image.jpg',
93+
'transformation' => [
94+
[
95+
'height' => '300',
96+
'effectGradient' => 'from-red_to-white',
97+
]
98+
],
99+
]
100+
);
101+
102+
echo "\n\n";
103+
echo "5. Gradient image URL: \n";
104+
echo "\033[01;32m$imageURL\033[0m";
105+
echo "\n";

sample/url_generation/index.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
echo "\n";
77

88
include_once('resize_crop_other_common_transformations.php');
9-
include_once('overlay.php');
109
include_once('image_enhancement_and_color_manipulation.php');
1110
include_once('chained_transformations.php');
1211
include_once('signed_url.php');

0 commit comments

Comments
 (0)