From 99685a95c183ead7b2ce7aa6c9ec32ebf1a88c9e Mon Sep 17 00:00:00 2001 From: ANKUR DWIVEDI Date: Thu, 18 Jan 2024 17:29:49 +0530 Subject: [PATCH] updated readme --- README.md | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 62976b0..1437d68 100644 --- a/README.md +++ b/README.md @@ -352,6 +352,29 @@ image_url = imagekit.url({ 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 ``` +**5. Arithmetic expressions In transformations** + +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. + +For example: + +```ruby +image_url = imagekit.url({ + path: "/default-image.jpg", + url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/", + transformation: [{ + width: "iw_div_4", + height: "ih_div_2", + border: "cw_mul_0.05_yellow" + }] +}); +``` + +**Sample Result URL** +``` +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 +``` + **List of transformations** 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. @@ -364,10 +387,10 @@ If you want to generate transformations in your application and add them to the |-------------------------------|-------------------------| | height | h | | width | w | -| aspectRatio | ar | +| aspect_ratio | ar | | quality | q | | crop | c | -| cropMode | cm | +| crop_mode | cm | | x | x | | y | y | | focus | fo | @@ -382,13 +405,15 @@ If you want to generate transformations in your application and add them to the | lossless | lo | | trim | t | | metadata | md | -| colorProfile | cp | -| defaultImage | di | +| color_profile | cp | +| default_image | di | | dpr | dpr | -| effectSharpen | e-sharpen | -| effectUSM | e-usm | -| effectContrast | e-contrast | -| effectGray | e-grayscale | +| effect_sharpen | e-sharpen | +| effect_usm | e-usm | +| effect_contrast | e-contrast | +| effect_gray | e-grayscale | +| effect_shadow | e-shadow | +| effect_gradient | e-gradient | | original | orig | | raw | `replaced by the parameter value` |