Skip to content

Commit 858ddaa

Browse files
ANKUR DWIVEDIANKUR DWIVEDI
authored andcommitted
added effectShadow and effectGradient prameters
1 parent f4bb947 commit 858ddaa

File tree

4 files changed

+48
-2
lines changed

4 files changed

+48
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,9 @@ If you want to generate transformations in your application and add them to the
507507
| effectSharpen | e-sharpen |
508508
| effectUSM | e-usm |
509509
| effectContrast | e-contrast |
510-
| effectGray | e-grayscale |
510+
| effectGray | e-grayscale
511+
| effectShadow | e-shadow |
512+
| effectGradient | e-gradient |
511513
| original | orig |
512514
| raw | `replaced by the parameter value` |
513515

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";

src/ImageKit/Constants/SupportedTransforms.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class SupportedTransforms
4949
'effectUSM' => 'e-usm',
5050
'effectContrast' => 'e-contrast',
5151
'effectGray' => 'e-grayscale',
52+
'effectShadow' => 'e-shadow',
53+
'effectGradient' => 'e-gradient',
5254
'original' => 'orig',
5355
'rotate' => 'rt',
5456
'overlayImageAspectRatio' => 'oiar',

tests/ImageKit/Url/UrlTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ public function testUrlAllCombined()
719719
'effectUSM' => '2-2-0.8-0.024',
720720
'effectContrast' => true,
721721
'effectGray' => true,
722+
'effectShadow' => 'bl-15_st-40_x-10_y-N5',
723+
'effectGradient' => 'from-red_to-white',
722724
'original' => true,
723725
'overlayImageFocus' => 'face',
724726
'raw' => 'h-500,w-450'
@@ -727,7 +729,7 @@ public function testUrlAllCombined()
727729
]);
728730

729731
UrlTest::assertEquals(
730-
'https://ik.imagekit.io/demo/tr:h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,ox-35,oy-35,ofo-bottom,oh-20,ow-20,oi-folder@@file.jpg,oit-false,oiar-4:3,oibg-0F0F0F,oib-10_0F0F0F,oidpr-2,oiq-50,oic-force,ot-two words,ots-20,otf-Open Sans,otc-00FFFF,oa-5,ott-b,obg-00AAFF55,ote-b3ZlcmxheSBtYWRlIGVhc3k%3D,otw-50,otbg-00AAFF55,otp-40,otia-left,or-10,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,e-sharpen-10,e-usm-2-2-0.8-0.024,e-contrast-true,e-grayscale-true,orig-true,oifo-face,h-500,w-450/default-image.jpg',
732+
'https://ik.imagekit.io/demo/tr:h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,ox-35,oy-35,ofo-bottom,oh-20,ow-20,oi-folder@@file.jpg,oit-false,oiar-4:3,oibg-0F0F0F,oib-10_0F0F0F,oidpr-2,oiq-50,oic-force,ot-two words,ots-20,otf-Open Sans,otc-00FFFF,oa-5,ott-b,obg-00AAFF55,ote-b3ZlcmxheSBtYWRlIGVhc3k%3D,otw-50,otbg-00AAFF55,otp-40,otia-left,or-10,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,e-sharpen-10,e-usm-2-2-0.8-0.024,e-contrast-true,e-grayscale-true,e-shadow-bl-15_st-40_x-10_y-N5,e-gradient-from-red_to-white,orig-true,oifo-face,h-500,w-450/default-image.jpg',
731733
$url
732734
);
733735
}

0 commit comments

Comments
 (0)