{"id":22916403,"url":"https://github.com/tpmanc/yii2-imagick","last_synced_at":"2025-05-12T17:05:19.203Z","repository":{"id":35743200,"uuid":"40022183","full_name":"tpmanc/yii2-imagick","owner":"tpmanc","description":"Class for working with Imagick","archived":false,"fork":false,"pushed_at":"2020-01-09T11:28:46.000Z","size":1182,"stargazers_count":18,"open_issues_count":2,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T17:04:57.077Z","etag":null,"topics":["imagick","php","yii2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpmanc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-31T19:47:41.000Z","updated_at":"2024-09-07T09:44:06.000Z","dependencies_parsed_at":"2022-09-17T11:25:52.775Z","dependency_job_id":null,"html_url":"https://github.com/tpmanc/yii2-imagick","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpmanc%2Fyii2-imagick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpmanc%2Fyii2-imagick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpmanc%2Fyii2-imagick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpmanc%2Fyii2-imagick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpmanc","download_url":"https://codeload.github.com/tpmanc/yii2-imagick/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253784908,"owners_count":21963899,"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":["imagick","php","yii2"],"created_at":"2024-12-14T06:12:42.474Z","updated_at":"2025-05-12T17:05:19.186Z","avatar_url":"https://github.com/tpmanc.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yii 2 Imagick\nYii 2 class for working with Imagick.\n\n## Install via Composer\n\nRun the following command\n\n```bash\n$ composer require tpmanc/yii2-imagick \"*\"\n```\n\nor add\n\n```bash\n$ \"tpmanc/yii2-imagick\": \"*\"\n```\n\nto the require section of your `composer.json` file.\n\nOriginal image:\n\n![\"Original\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/original.jpg)\n\n## Get size\n\n```php\n$img = Imagick::open('./image.jpg');\n$img-\u003egetWidth();\n$img-\u003egetHeight();\n```\n\n## Resize image\n\n```php\nImagick::open('./image.jpg')-\u003eresize(400, 300)-\u003esaveTo('./resized.jpg');\nImagick::open('./image.jpg')-\u003eresize(400, false)-\u003esaveTo('./resized.jpg');\n```\n\n![\"Resize\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/resize.jpg)\n\n## Create thumbnail\n\n```php\nImagick::open('./image.jpg')-\u003ethumb(200, 200)-\u003esaveTo('./thumb.jpg');\n```\n\n![\"Thumb\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/thumb.jpg)\n\n## Add border\n\n```php\n$width = 5;\n$color = '#000'\nImagick::open('./image.jpg')-\u003eborder($width, $color)-\u003esaveTo('./result.jpg');\n```\n\n![\"Resize\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/border-1.jpg)\n\n```php\n$width = 10;\n$color = '#A91AD4'\nImagick::open('./image.jpg')-\u003eborder($width, $color)-\u003esaveTo('./result.jpg');\n```\n\n![\"Resize\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/border-2.jpg)\n\n## Vertical and horizontal mirror image\n\n```php\n// vertical\nImagick::open('./image.jpg')-\u003eflip()-\u003esaveTo('./result.jpg');\n// horizontal\nImagick::open('./image.jpg')-\u003eflop()-\u003esaveTo('./result.jpg');\n```\n\n![\"Flip\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/flip.jpg)\n\n![\"Flop\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/flop.jpg)\n\n## Crop\n\n```php\n$xStart = 0;\n$yStart = 0;\n$xEnd = 150;\n$yEnd = 150;\nImagick::open('./image.jpg')-\u003ecrop($xStart, $yStart, $xEnd, $yEnd)-\u003esaveTo('./result.jpg');\n```\n\n![\"Crop\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/crop.jpg)\n\n## Blur\n\n```php\n$radius = 8;\n$delta = 5;\nImagick::open('./image.jpg')-\u003eblur($radius, $delta)-\u003esaveTo('./result.jpg');\n```\n\n![\"Blur\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/blur.jpg)\n\n## Watermark\n\n### Set watermark position\n\nUse `$xPosition` and `$yPosition` to set watermark position.\n\n`$xPosition` should be 'left', 'right' or 'center'; `$yPosition` should be 'top', 'bottom' or 'center'.\n\n```php\n$xPosition = 'left';\n$yPosition = 'top';\nImagick::open('./image.jpg')-\u003ewatermark('./watermark.png'), $xPosition, $yPosition)-\u003esaveTo('./result.jpg');\n```\n\n![\"Watermark\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/watermark-1.jpg)\n\n```php\n$xPosition = 'right';\n$yPosition = 'center';\nImagick::open('./image.jpg')-\u003ewatermark('./watermark.png'), $xPosition, $yPosition)-\u003esaveTo('./result.jpg');\n```\n\n![\"Watermark\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/watermark-2.jpg)\n\n### Set watermark size\n\nUse `$xSize` and `$ySize` to set watermark size. Valid values:\n\n * Number: `$xSize = 100;`, `$ySize = 50`\n\n * Percent of parent: `$xSize = '100%';`, `$ySize = '50%'`\n\n * `'auto'` to save proportion: `$xSize = '100%';`, `$ySize = 'auto'`\n\n * `false`: `$xSize = 100;`, `$ySize = false`\n\n```php\n$xPosition = 'center';\n$yPosition = 'center';\n$xSize = '100%';\n$ySize = 'auto';\nImagick::open('./image.jpg')-\u003ewatermark('./watermark.png'), $xPosition, $yPosition, $xSize, $ySize)-\u003esaveTo('./result.jpg');\n```\n\n![\"Watermark\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/watermark-3.jpg)\n\n```php\n$xPosition = 'center';\n$yPosition = 'center';\n$xSize = '100%';\n$ySize = '100%';\nImagick::open('./image.jpg')-\u003ewatermark('./watermark.png'), $xPosition, $yPosition, $xSize, $ySize)-\u003esaveTo('./result.jpg');\n```\n\n![\"Watermark\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/watermark-4.jpg)\n\n### Set watermark offset\n\nUse `$xOffset` and `$yOffset` to set offset from parent image border.\n\n```php\n$xPosition = 'right';\n$yPosition = 'bottom';\n$xSize = false;\n$ySize = false;\n$xOffset = 50;\n$yOffset = 50;\nImagick::open('./image.jpg')-\u003ewatermark('./watermark.png'), $xPosition, $yPosition, $xSize, $ySize, $xOffset, $yOffset)-\u003esaveTo('./result.jpg');\n```\n![\"Watermark\"](https://raw.github.com/tpmanc/yii2-imagick/master/examples/watermark-5.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpmanc%2Fyii2-imagick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpmanc%2Fyii2-imagick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpmanc%2Fyii2-imagick/lists"}