{"id":19756420,"url":"https://github.com/vormkracht10/php-uploadcare-transformations","last_synced_at":"2025-04-30T11:33:27.385Z","repository":{"id":41871525,"uuid":"443031559","full_name":"vormkracht10/php-uploadcare-transformations","owner":"vormkracht10","description":"Fluent PHP syntax for Uploadcare transformations","archived":false,"fork":false,"pushed_at":"2025-02-11T08:46:08.000Z","size":306,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T01:41:17.286Z","etag":null,"topics":["files","image-manipulation","image-processing","php","uploadcare","uploads"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vormkracht10.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"vormkracht10"}},"created_at":"2021-12-30T09:44:20.000Z","updated_at":"2025-02-11T08:45:48.000Z","dependencies_parsed_at":"2024-05-02T15:38:54.765Z","dependency_job_id":"80541a6a-1e9a-4582-8137-686b298c8d78","html_url":"https://github.com/vormkracht10/php-uploadcare-transformations","commit_stats":{"total_commits":258,"total_committers":6,"mean_commits":43.0,"dds":0.3178294573643411,"last_synced_commit":"fd951cf2070081fc4b254d13899c926f3ab6f945"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":"spatie/package-skeleton-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vormkracht10%2Fphp-uploadcare-transformations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vormkracht10%2Fphp-uploadcare-transformations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vormkracht10%2Fphp-uploadcare-transformations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vormkracht10%2Fphp-uploadcare-transformations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vormkracht10","download_url":"https://codeload.github.com/vormkracht10/php-uploadcare-transformations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251691626,"owners_count":21628358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["files","image-manipulation","image-processing","php","uploadcare","uploads"],"created_at":"2024-11-12T03:15:52.966Z","updated_at":"2025-04-30T11:33:26.336Z","avatar_url":"https://github.com/vormkracht10.png","language":"PHP","funding_links":["https://github.com/sponsors/vormkracht10"],"categories":[],"sub_categories":[],"readme":"# Easy [Uploadcare](https://uploadcare.com/?via=vk10) Image Transformation URLs generation\n\n[![Total Downloads](https://img.shields.io/packagist/dt/vormkracht10/php-uploadcare-transformations.svg?style=flat-square)](https://packagist.org/packages/vormkracht10/php-uploadcare-transformations)\n[![Tests](https://github.com/vormkracht10/php-uploadcare-transformations/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/vormkracht10/php-uploadcare-transformations/actions/workflows/run-tests.yml)\n[![PHPStan](https://github.com/vormkracht10/php-uploadcare-transformations/actions/workflows/phpstan.yml/badge.svg?branch=main)](https://github.com/vormkracht10/php-uploadcare-transformations/actions/workflows/phpstan.yml)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/vormkracht10/php-uploadcare-transformations)\n![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/vormkracht10/php-uploadcare-transformations)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/vormkracht10/php-uploadcare-transformations.svg?style=flat-square)](https://packagist.org/packages/vormkracht10/php-uploadcare-transformations)\n\nGenerate [Uploadcare](https://uploadcare.com/?via=vk10) image processing URLs to transform and process your images. No need to write or generate the URL yourself. Just pass the UUID of the file, optionally pass the custom CDN and chain the methods you want to apply and the package generates the URL for you.\n\n-   [Requirements](#requirements)\n-   [Installation](#installation)\n-   [Usage](#usage)\n-   [Documentation](#documentation)\n    -   [Using percentages or pixels as parameter](#using-percentages-or-pixels-as-parameter)\n    -   [List of possible transformations](#list-of-possible-transformations)\n-   [Usage](#usage-1)\n    -   [Auto rotate](#auto-rotate)\n    -   [Basic color adjustments](#basic-color-adjustments)\n    -   [Blur](#blur)\n    -   [Blur faces](#blur-faces)\n    -   [Blur region](#blur-region)\n    -   [Convert to sRGB](#convert-to-srgb)\n    -   [Crop](#crop)\n    -   [Crop by objects](#crop-by-objects)\n    -   [Crop by ratio](#crop-by-ratio)\n    -   [Enhance](#enhance)\n    -   [Filter](#filter)\n    -   [Flip](#flip)\n    -   [Format](#format)\n    -   [Grayscale](#grayscale)\n    -   [ICC profile size threshold](#icc-profile-size-threshold)\n    -   [Invert](#invert)\n    -   [Miror](#miror)\n    -   [Overlay](#overlay)\n    -   [Preview](#preview)\n    -   [Progressive](#progressive)\n    -   [Quality](#quality)\n    -   [Rasterize](#rasterize)\n    -   [Resize](#resize)\n    -   [Rotate](#rotate)\n    -   [Scale crop](#scale-crop)\n    -   [Set fill](#set-fill)\n    -   [Sharpen](#sharpen)\n    -   [Smart crop](#smart-crop)\n    -   [Smart resize](#smart-resize)\n    -   [Zoom objects](#zoom-objects)\n-   [Testing](#testing)\n-   [Changelog](#changelog)\n-   [Contributing](#contributing)\n-   [Security Vulnerabilities](#security-vulnerabilities)\n-   [Credits](#credits)\n-   [License](#license)\n\n## Requirements\n\n\u003cul\u003e\n  \u003cli\u003ePHP 8.1+\u003c/li\u003e\n\u003c/ul\u003e\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require vormkracht10/php-uploadcare-transformations\n```\n\n## Usage\n\n\u003col\u003e\n    \u003cli\u003e\n        Import UploadcareTransformation.\n    \u003c/li\u003e\n     \u003cli\u003e\n        Get the UUID of the file you want to show.\n    \u003c/li\u003e\n     \u003cli\u003e\n        Set your CDN url (optional).\n    \u003c/li\u003e\n     \u003cli\u003e\n        Create the transformation URL by chaining one or multiple methods to the UploadcareTransformation class. You can chain as much methods as you want.\n    \u003c/li\u003e\n    \u003cli\u003eUse the output of the transformation as image source.\u003c/li\u003e\n\u003c/ol\u003e\n\n```php\nuse Vormkracht10\\UploadcareTransformations\\UploadcareTransformation;\n\n$uuid = '12a3456b-c789-1234-1de2-3cfa83096e25';\n$cdnUrl = 'https://example.com/cdn/';\n\n$transformation = (new UploadcareTransformation($uuid, $cdnUrl));\n\n$url = $transformation-\u003ecrop(width: 320, height: '50p', offsetX: 'center')-\u003esetFill(color: 'ffffff');\n\necho $url;\n// https://example.com/cdn/12a3456b-c789-1234-1de2-3cfa83096e25/-/crop/320x50p/center/-/set_fill/ffffff\n```\n\nIf you prefer to use a shorter version you can also use the helper method:\n\n```php\n$uuid = '12a3456b-c789-1234-1de2-3cfa83096e25';\n$cdnUrl = 'https://example.com/cdn/';\n\n$url = uc($uuid, $cdnUrl)\n        -\u003ecrop(width: 320, height: '50p', offsetX: 'center')\n        -\u003esetFill(color: 'ffffff')\n        -\u003egetUrl();\n\necho $url;\n// https://example.com/cdn/12a3456b-c789-1234-1de2-3cfa83096e25/-/crop/320x50p/center/-/set_fill/ffffff\n```\n\n### Using the Laravel framework\n\nWhen you are using the Laravel framework it might be better to define the CDN in your `.env` file and get the value from the `.env` file in a config file. You can create a dedicated `config/uploadcare` config or add it to the `config/services` file.\n\nYour `.env` file:\n\n```dotenv\nUPLOADCARE_CDN_URL=https://ucarecdn.com\nUPLOADCARE_PROXY_URL=https://endpoint.ucr.io\n```\n\nAdd to `config/services.php` file:\n\n```php\n'uploadcare' =\u003e [\n    'cdn_url' =\u003e env('UPLOADCARE_CDN_URL', 'https://ucarecdn.com'),\n    'proxy_url' =\u003e env('UPLOADCARE_PROXY_URL', 'https://endpoint.ucr.io'),\n],\n```\n\nIn your code:\n\n```php\n$url = uc($uuid, config('services.uploadcare.cdn_url'))-\u003ecrop(width: 320, height: '50p', offsetX: 'center')-\u003esetFill(color: 'ffffff');\n```\n\n## Documentation\n\n### Using percentages or pixels as parameter\n\nIn some of the methods you can pass parameters in various ways. For example in the [scaleCrop()](/src/Transformations/ScaleCrop.php) method you can pass the offset in the form of a percentage or pixels. To make it easier to recognize when a pixel or percentage is used you can pass the parameters as following.\n\n```php\n// Using percentages\n$url = $transformation-\u003escaleCrop(width: 320, height: 320, offsetX: '50p', offsetY: '60p');\n// https://example.com/cdn/12a3456b-c789-1234-1de2-3cfa83096e25/scale_crop/320x320/50px60p/\n\n\n// Using pixels\n$url = $transformation-\u003escaleCrop(width: 320, height: 320, offsetX: 50, offsetY: 60);\n// https://example.com/cdn/12a3456b-c789-1234-1de2-3cfa83096e25/scale_crop/320x320/50x60/\n```\n\n\u003e As stated in the Uploadcare Documentation, in URLs, % is an escape character and should be encoded with %25 escape sequence, e.g. /scale_crop/440x440/80%25,80%25/. For convenience, we can use the p shortcut for percent which doesn't require encoding.\n\n### List of possible transformations\n\nEach transformation follows the documentation on Uploadcare which you may find \u003ca href=\"https://uploadcare.com/docs/\"\u003ehere\u003c/a\u003e.\nThe current list of possible transformations and where to find the documentation:\n\n| Transformation                                            |                                                 Uploadcare Documentation link                                                  |\n| --------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------: |\n| [Auto rotate](#auto-rotate)                               |     \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/rotate-flip/#operation-autorotate\"\u003eLink\u003c/a\u003e     |\n| [Basic color adjustments](#basic-color-adjustments)       |      \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#image-colors-operations\"\u003eLink\u003c/a\u003e      |\n| [Blur](#blur)                                             |       \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/blur-sharpen/#operation-blur\"\u003eLink\u003c/a\u003e        |\n| [Blur faces](#blur-faces)                                 | \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/blur-sharpen/#operation-blur-region-faces\"\u003eLink\u003c/a\u003e |\n| [Blur region](#blur-region)                               |    \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/blur-sharpen/#operation-blur-region\"\u003eLink\u003c/a\u003e    |\n| [Convert to sRGB](#convert-to-srgb)                       |          \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-srgb\"\u003eLink\u003c/a\u003e           |\n| [Crop](#crop)                                             |        \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-crop\"\u003eLink\u003c/a\u003e        |\n| [Crop by objects](#crop-by-objects)                       |     \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-crop-tags\"\u003eLink\u003c/a\u003e      |\n| [Crop by ratio](#crop-by-ratio)                           | \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-crop-aspect-ratio\"\u003eLink\u003c/a\u003e  |\n| [Enhance](#enhance)                                       |         \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-enhance\"\u003eLink\u003c/a\u003e         |\n| [Filter](#filter)                                         |         \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-filter\"\u003eLink\u003c/a\u003e          |\n| [Flip](#flip)                                             |          \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-flip\"\u003eLink\u003c/a\u003e           |\n| [Format](#format)                                         |       \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/compression/#operation-format\"\u003eLink\u003c/a\u003e       |\n| [Grayscale](#grayscale)                                   |        \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-grayscale\"\u003eLink\u003c/a\u003e        |\n| [ICC profile size threshold](#icc-profile-size-threshold) |      \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-max-icc-size\"\u003eLink\u003c/a\u003e       |\n| [Invert](#invert)                                         |        \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-inverting\"\u003eLink\u003c/a\u003e        |\n| [Miror](#miror)                                           |         \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-mirror\"\u003eLink\u003c/a\u003e          |\n| [Overlay](#overlay)                                       |          \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/overlay/#overlay-image\"\u003eLink\u003c/a\u003e           |\n| [Preview](#preview)                                       |      \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-preview\"\u003eLink\u003c/a\u003e       |\n| [Progressive](#progressive)                               |    \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/compression/#operation-progressive\"\u003eLink\u003c/a\u003e     |\n| [Quality](#quality)                                       |      \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/compression/#operation-quality\"\u003eLink\u003c/a\u003e       |\n| [Rasterize](#rasterize)                                   |                   \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/#svg\"\u003eLink\u003c/a\u003e                    |\n| [Resize](#resize)                                         |       \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-resize\"\u003eLink\u003c/a\u003e       |\n| [Rotate](#rotate)                                         |         \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-rotate\"\u003eLink\u003c/a\u003e          |\n| [Scale crop](#scale-crop)                                 |     \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-scale-crop\"\u003eLink\u003c/a\u003e     |\n| [Set fill](#set-fill)                                     |      \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-setfill\"\u003eLink\u003c/a\u003e       |\n| [Sharpen](#sharpen)                                       |         \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/colors/#operation-sharpen\"\u003eLink\u003c/a\u003e         |\n| [Smart crop](#smart-crop)                                 |     \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-smart-crop\"\u003eLink\u003c/a\u003e     |\n| [Smart resize](#smart-resize)                             |    \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-smart-resize\"\u003eLink\u003c/a\u003e    |\n| [Zoom objects](#zoom-objects)                             |    \u003ca target=\"_blank\" href=\"https://uploadcare.com/docs/transformations/image/resize-crop/#operation-zoom-objects\"\u003eLink\u003c/a\u003e    |\n\n## Usage\n\n### Adding filename\n\nOriginal filenames can be accessed via Uploadcare's REST API. This can be done by making a request to receive a JSON response with file parameters including `original_filename`.\n\nYou can set an optional filename that users will see instead of the original name:\n\n```php\n$url = $transformation-\u003eautoRotate(false)-\u003efilename('my-filename.jpg');\n// https://example.com/cdn/.../-/autorotate/no/my-filename.jpg\n```\n\n\u003e Please note that the filename should comply with \u003ca href=\"https://tools.ietf.org/html/rfc3986#section-3.3\"\u003efile name conventions\u003c/a\u003e. For more more information about how to use filenames please check the \u003ca href=\"https://uploadcare.com/docs/delivery/cdn/#cdn-filename\"\u003eUploadcare API documentation\u003c/a\u003e.\n\n### Auto rotate\n\nThe default behavior goes with parsing EXIF tags of original images and rotating them according to the “Orientation” tag. Using `false` as parameter allows turning off the default behavior.\n\n```php\n$url = $transformation-\u003eautoRotate(false);\n// https://example.com/cdn/.../-/autorotate/no/\n\n$url = $transformation-\u003eautoRotate(true);\n// https://example.com/cdn/.../-/autorotate/yes/\n```\n\n### Basic color adjustments\n\nThe value parameter controls the strength of any applied adjustment. Ranges of the value parameter differ between operations. There also is a zero point for each operation — the value producing outputs equal to original images.\n\nAdjustment (color) must be one of the following values: `brightness`, `exposure`, `contrast`, `saturation`, `gamma`, `vibrance`, `warmth`.\n\nFor a complete overview of allowed values based upon the chosen adjustment, take a look at the [Uploadcare Documentation](https://uploadcare.com/docs/transformations/image/colors/#image-colors-operations).\n\n```php\n$url = $transformation-\u003ebasicColorAdjustments(color: 'brightness', value: 50);\n// https://example.com/cdn/.../-/adjust/brightness/50/\n```\n\n### Blur\n\nBlurs images by the strength factor. The filtering mode is Gaussian Blur, where strength parameter sets the blur radius — effect intensity.\n\n```php\n$url = $transformation-\u003eblur(strength: 50, amount: null);\n// https://example.com/cdn/.../-/blur/50/\n```\n\n### Blur faces\n\nWhen faces is specified the regions are selected automatically by utilizing face detection.\n\n```php\n$url = $transformation-\u003eblurFaces(strength: 50);\n// https://example.com/cdn/.../-/blur_faces/50/\n```\n\n### Blur region\n\nBlurs the specified region of the image by the strength factor. The filtering mode is Gaussian Blur, where strength parameter sets the blur radius — effect intensity.\n\nDimensions and coordinates must be pixels or percentages.\n\n```php\n// Using pixels.\n$url = $transformation-\u003eblurRegion(dimensionX: 250, dimensionY: 250, coordinateX: 50, coordinateY: 50, strength: 200);\n// https://example.com/cdn/.../-/blur_region/250/250/50/50/200/\n\n// Using percentages.\n$url = $transformation-\u003eblurRegion(dimensionX: '50p', dimensionY: '50p', coordinateX: '80p', coordinateY: '20p', strength: 200);\n// https://example.com/cdn/.../-/blur_region/50p/50p/80p,20p/200/\n```\n\n### Convert to sRGB\n\nThe operation sets how Uploadcare behaves depending on different color profiles of uploaded images. See the [Uploadcare Documentation](https://uploadcare.com/docs/transformations/image/colors/#operation-srgb) to learn more about the possible outcomes.\n\nThe profile parameter must be one of the following values: `fast`, `icc`, `keep_profile`.\n\n```php\n$url = $transformation-\u003econvertToSRGB(profile: 'icc');\n// https://example.com/cdn/.../-/srgb/icc/\n```\n\n### Crop\n\nCrops an image by using specified dimensions and alignment.\n\nDimensions parameters can be in pixels or percentages. To see how pixels or percentages can be used, see the [Using percentages or pixels as parameter](#using-percentages-or-pixels-as-parameter) paragraph.\n\nAlignment can also be in pixels and percentages but also a shortcut can be used. The possible values are: `top`, `center`, `bottom`, `left`, `right`.\n\n```php\n// Using percentages and a shortcut.\n$url = $transformation-\u003ecrop(width: 100, height: '50p', offsetX: 'center');\n// https://example.com/cdn/.../-/crop/100x50p/center/\n\n// Using pixels only.\n$url = $transformation-\u003ecrop(width: 100, height: 100, offsetX: 50, offsetY: 50);\n// https://example.com/cdn/.../-/crop/100x100/50,50/\n\n// Using both pixels and percentages.\n$url = $transformation-\u003ecrop(width: 100, height: '50p', offsetX: '25p', offsetY: '25p');\n// https://example.com/cdn/.../-/crop/100x50p/25p,25p/\n```\n\n### Crop by objects\n\nCrops the image to the object specified by the tag parameter.\n\nTag can be one of `face` or `image`.\n\nRatio are two numbers greater than zero separated by :. Ratio is the quotient from the division of these numbers.\n\nDimensions and alignment must be set in percentages. In case of the alignment you can also use the shortcut. The possible values are: `top`, `center`, `bottom`, `left`, `right`. If alignment is not specified, `center` value is used.\n\n\u003e Dimensions should be relative when used with a tag. So you are required to set both width and height with pixels.\n\n```php\n// Using no ratio, percentages and pixels combined.\n$url = $transformation-\u003ecropByObjects(tag: 'face', ratio: null, width: '50p', height: '50p');\n// https://example.com/cdn/../-/crop/face/50px50p/\n\n// Using ratio, percentages and a shortcut.\n$url = $transformation-\u003ecropByObjects(tag: 'face', ratio: '4:3', width: '50p', height: '50p', offsetX: 'bottom');\n// https://example.com/cdn/../-/crop/face/4:3/50px50p/bottom/\n```\n\n### Crop by ratio\n\nCrops the image to the specified aspect ratio, cutting off the rest of the image.\n\nRatio are two numbers greater than zero separated by :. Ratio is the quotient from the division of these numbers.\n\nAlignment can be set in pixels and percentages but also a shortcut can be used. The possible values are: `top`, `center`, `bottom`, `left`, `right`. If alignment is not specified, `center` value is used.\n\n```php\n// Using percentages and a shortcut.\n$url = $transformation-\u003ecropByRatio(ratio: '4:3', offsetX: 'bottom');\n// https://example.com/cdn/.../-/crop/4:3/bottom/\n\n// Using percentage in combination with pixels.\n$url = $transformation-\u003ecropByRatio(ratio: '4:3', offsetX: '50p', offsetY: 240);\n// https://example.com/cdn/.../-/crop/4:3/50p,240/\n```\n\n### Enhance\n\nAuto-enhances an image by performing the following operations: auto levels, auto contrast, and saturation sharpening.\n\nStrength must be a number between 0 and 100. Default value is 50.\n\n```php\n$url = $transformation-\u003eenhance(strength: 50);\n// https://example.com/cdn/.../-/enhance/50/\n```\n\n### Filter\n\nApplies one of predefined photo filters by its name. The way your images look affects their engagement rates. You apply filters thus providing beautiful images consistent across content pieces you publish.\n\nThe name parameter should be one of the following: `adaris`, `briaril`, `calarel`, `carris`, `cynarel`, `cyren`, `elmet`, `elonni`, `enzana`, `erydark`, `fenralan`, `ferand`, `galen`, `gavin`, `gethriel`, `iorill`, `iothari`, `iselva`, `jadis`, `lavra`, `misiara`, `namala`, `nerion`, `nethari`, `pamaya`, `sarnar`, `sedis`, `sewen`, `sorahel`, `sorlen`, `tarian`, `thellassan`, `varriel`, `varven`, `vevera`, `virkas`, `yedis`, `yllara`, `zatvel`, `zevcen`.\n\nThe amount parameter must be a number between -100 and 200.\n\n```php\n$url = $transformation-\u003efilter(name: 'adaris', value: 50);\n// https://example.com/cdn/.../-/filter/adaris/50/\n```\n\n### Flip\n\nFlips images.\n\n```php\n$url = $transformation-\u003eflip();\n// https://example.com/cdn/.../-/flip/\n```\n\n### Format\n\nConverts an image to one of the following formats: `jpg`, `png`, `webp`, `auto`.\n\n```php\n$url = $transformation-\u003eformat(format: 'jpeg');\n// https://example.com/cdn/.../-/format/jpg/\n```\n\n### Grayscale\n\nDesaturates images. The operation has no additional parameters and simply produces a grayscale image output when applied.\n\n```php\n$url = $transformation-\u003egrayscale();\n// https://example.com/cdn/.../-/grayscale/\n```\n\n### ICC profile size threshold\n\nThe operation defines which RGB color profile sizes will be considered “small” and “large” when using srgb in `fast` or `icc` modes. The `number` stands for the ICC profile size in kilobytes.\n\nThe default value is 10 (10240 bytes). Most of the common RGB profile sizes (sRGB, Display P3, ProPhoto, Adobe RGB, Apple RGB) are below the threshold.\n\n\u003e Please note, that because this transformation should always be used in combination with [`convertToSRGB()`](#convert-to-srgb) its method should be called \u003cstrong\u003eafter\u003c/strong\u003e `convertToSRGB()`. Otherwise the ICC profile size threshold gets overwritten by the `convertToSRGB()` transformation.\n\n```php\n$url = $transformation-\u003econvertToSRGB(profile: 'fast')-\u003eiccProfileSizeThreshold(number: 10);\n// https://example.com/cdn/.../-/max_icc_size/10/srgb/fast/\n```\n\n### Invert\n\nInverts images rendering a 'negative' of the input.\n\n```php\n$url = $transformation-\u003einvert();\n// https://example.com/cdn/.../-/invert/\n```\n\n### Miror\n\nMirrors images.\n\n```php\n$url = $transformation-\u003emirror();\n// https://example.com/cdn/.../-/mirror/\n```\n\n### Overlay\n\nThe overlay operation allows to layer images one over another. One of the most common use cases here are watermarks: semi-transparent images layered over opaque ones to complicate their unauthorized usage, etc.\n\n\u003e Every overlay parameter is optional and can be omitted. However, the order of parameter URL directives should be preserved. For example, if you want to use `coordinateX` parameter, you should also specify `width` and `height` parameters. Also note that the `opacity` parameter should be specified with percentages.\n\n```php\n$uuidOverlay = 'e6b0c1c0-1b1a-4b1a-9b1a-1b1a1b1a1b1a';\n\n$url = $transformation-\u003eoverlay(\n  uuid: $uuidOverlay,\n  width: 150,\n  height: 150,\n  coordinateX: 200,\n  coordinateY: 300,\n  opacity: '25p'\n)-\u003egetUrl();\n// https://example.com/cdn/.../-/overlay/e6b0c1c0-1b1a-4b1a-9b1a-1b1a1b1a1b1a/150x150/200,300/25p/\n```\n\n### Preview\n\nDownscales an image proportionally to fit the given width and height in pixels.\n\n```php\n$url = $transformation-\u003epreview(width: 100, height: 100);\n// https://example.com/cdn/.../-/preview/100x100/\n```\n\n### Progressive\n\nReturns a progressive image. In progressive images, data are compressed in multiple passes of progressively higher detail. The operation does not affect non-JPEG images; does not force image formats to JPEG.\n\n```php\n$url = $transformation-\u003eprogressive(true);\n// https://example.com/cdn/.../-/progressive/yes/\n\n$url = $transformation-\u003eprogressive(false);\n// https://example.com/cdn/.../-/progressive/no/\n```\n\n### Quality\n\nSets output JPEG and WebP quality. Since actual settings vary from codec to codec, and more importantly, from format to format, we provide five simple tiers and two automatic values which suits most cases of image distribution and are consistent.\n\nQuality must be one of the following values: `smart`, `smart_retina`, `normal`, `better`, `best`, `lighter`, `lightest`.\n\n```php\n$url = $transformation-\u003equality(quality: 'smart');\n// https://example.com/cdn/.../-/quality/smart/\n```\n\n### Rasterize\n\nRasterize SVG images.\n\n```php\n$url = $transformation-\u003erasterize();\n// https://example.com/cdn/.../-/rasterize/\n```\n\n### Resize\n\nResizes an image to one or two dimensions. When you set both width and height explicitly, it may result in a distorted image. If you specify either side, this operation will preserve the original aspect ratio and resize the image accordingly. Mode should be one of the following values: `on`, `off`, `fill`.\n\n```php\n// Using width, height, stretch and 'fill' mode.\n$url = $transformation-\u003eresize(width: 100, height: null, stretch: true, mode: 'fill');\n// https://example.com/cdn/.../-/resize/100x/stretch/fill/\n\n// Using only height, no stretch and no mode.\n$url = $transformations-\u003eresize(width: null, height: 250, stretch: false);\n// https://example.com/cdn/.../-/resize/250x/\n````\n\n### Rotate\n\nRight-angle image rotation, counterclockwise. The value of angle must be a multiple of 90.\n\n```php\n$url = $transformation-\u003erotate(angle: 180);\n// https://example.com/cdn/.../-/rotate/180/\n```\n\n### Scale crop\n\nScales an image until it fully covers the specified dimensions; the rest gets cropped. Mostly used to place images with various dimensions into placeholders (e.g., square shaped).\n\nDimensions must be set in pixels.\n\nAlignment must be set in percentages or shortcut. The possible values are: `top`, `center`, `bottom`, `left`, `right`. If alignment is not specified, `0,0` value is used.\n\n```php\n// Using percentages.\n$url = $transformation-\u003escaleCrop(width: 100, height: 100, offsetX: '30p', offsetY: '50p');\n// https://example.com/cdn/.../-/scale_crop/100x100/30p,50p/\n\n// Using shortcut.\n$url = $transformation-\u003escaleCrop(width: 100, height: 100, offsetX: 'bottom');\n// https://example.com/cdn/../-/scale_crop/100x100/bottom/\n```\n\n### Set fill\n\nSets the fill color used with crop, stretch or when converting an alpha channel enabled image to JPEG.\n\nColor must be a hex color code \u003cb\u003ewithout using the hashtag\u003c/b\u003e.\n\n```php\n$url = $transformation-\u003esetFill(color: 'ff0000');\n// https://example.com/cdn/.../-/setfill/ff0000/\n```\n\n### Sharpen\n\nSharpens an image, might be especially useful with images that were subjected to downscaling. strength can be in the range from 0 to 20 and defaults to the value of 5.\n\n```php\n$url = $transformation-\u003esharpen(strength: 20);\n// https://example.com/cdn/.../-/sharp/20/\n```\n\n### Smart crop\n\nSwitching the crop type to one of the smart modes enables the content-aware mechanics. Uploadcare applies AI-based algorithms to detect faces and other visually sensible objects to crop the background and not the main object.\n\nDimensions must be set in pixels.\n\nType must be one of the following values: `smart`, `smart_faces_objects`, `smart_faces`, `smart_objects`, `smart_faces_points`, `smart_points`, `smart_objects_faces_points`, `smart_objects_points` or `smart_objects_faces`.\n\nAligment must be set in percentages or shortcut. The possible values are: `top`, `center`, `bottom`, `left`, `right`. If alignment is not specified, `0,0` value is used.\n\n```php\n// Using percentages.\n$url = $transformation-\u003esmartCrop(width: 100, height: 100, type: 'smart_faces_objects', offsetX: '30p', offsetY: '50p');\n// https://example.com/cdn/.../-/scale_crop/100x100/smart_faces_objects/30p,50p/\n\n// Using shortcut.\n$url = $transformation-\u003esmartCrop(width: 100, height: 100, type: 'smart_faces_objects', offsetX: 'right');\n// https://example.com/cdn/.../-/scale_crop/100x100/smart_faces_objects/right/\n```\n\n### Smart resize\n\nContent-aware resize helps retaining original proportions of faces and other visually sensible objects while resizing the rest of the image using intelligent algorithms.\n\n```php\n$url = $transformation-\u003esmartResize(width: 500, height: 500);\n// https://example.com/cdn/.../-/smart_resize/500x500/\n```\n\n### Zoom objects\n\nZoom objects operation is best suited for images with solid or uniform backgrounds.\n\nZoom must be a number between 1 and 100.\n\n```php\n$url = $transformation-\u003ezoomObjects(zoom: 50);\n// https://example.com/cdn/.../-/zoom_objects/50/\n```\n\n## Testing\n\n```bash\n./-/vendor/bin/pest\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../-/../-/security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n-   [Bas van Dinther](https://github.com/baspa)\n-   [Mark van Eijk](https://github.com/markvaneijk)\n-   [All Contributors](../-/../-/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvormkracht10%2Fphp-uploadcare-transformations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvormkracht10%2Fphp-uploadcare-transformations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvormkracht10%2Fphp-uploadcare-transformations/lists"}