{"id":15389124,"url":"https://github.com/splitbrain/slika","last_synced_at":"2025-04-15T17:32:44.559Z","repository":{"id":57056953,"uuid":"260433614","full_name":"splitbrain/slika","owner":"splitbrain","description":"Simple image handling for PHP","archived":false,"fork":false,"pushed_at":"2024-11-25T09:36:11.000Z","size":122,"stargazers_count":4,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T00:22:48.003Z","etag":null,"topics":["crop","gd","image","image-crop","image-processing","image-resize","image-rotate","imagemagick","libgd","php","php-library","resize"],"latest_commit_sha":null,"homepage":"https://splitbrain.github.io/slika/","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/splitbrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-01T10:32:53.000Z","updated_at":"2023-03-12T10:06:50.000Z","dependencies_parsed_at":"2022-08-24T14:53:00.547Z","dependency_job_id":"37405417-3ea2-4f19-9e6a-13cb43f57442","html_url":"https://github.com/splitbrain/slika","commit_stats":{"total_commits":23,"total_committers":4,"mean_commits":5.75,"dds":"0.13043478260869568","last_synced_commit":"11cda8925c9f82088df7444d133fe88842b7a8d7"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitbrain%2Fslika","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitbrain%2Fslika/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitbrain%2Fslika/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitbrain%2Fslika/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/splitbrain","download_url":"https://codeload.github.com/splitbrain/slika/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249118912,"owners_count":21215640,"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":["crop","gd","image","image-crop","image-processing","image-resize","image-rotate","imagemagick","libgd","php","php-library","resize"],"created_at":"2024-10-01T14:59:30.913Z","updated_at":"2025-04-15T17:32:44.265Z","avatar_url":"https://github.com/splitbrain.png","language":"PHP","readme":"# Slika - simple image handling for PHP\n\nThis is a library that covers only the bare basics you need when handling images:\n\n  * resizing\n  * cropping\n  * rotation\n\nIt can use either PHP's libGD or a locally installed ImageMagick binary.\n\n## Installation\n\nUse composer\n\n    composer require splitbrain/slika\n\n## Usage\n\nSimply get an Adapter from the Slika factory, run some operations on it and call `save`.\n\nOperations can be chained together. Consider the chain to be one command. Do not reuse the adapter returned by `run()`, it is a single use object. All operations can potentially throw a `\\splitbrain\\slika\\Exception`.\n\nOptions (see below) can be passed as a second parameter to the `run` factory. \n\n```php\nuse \\splitbrain\\slika\\Slika;\nuse \\splitbrain\\slika\\Exception;\n\n$options = [\n    'quality' =\u003e 75\n];\n\ntry {\n    Slika::run('input.png', $options)\n        -\u003eresize(500,500)\n        -\u003erotate(Slika::ROTATE_CCW\n        -\u003esave('output.jpg', 'jpg');\n} catch (Exception $e) {\n    // conversion went wrong, handle it\n}\n```\n\nPlease also check the [API Docs](https://splitbrain.github.io/slika/) for details.\n\n## Operations \n\n### resize\n\nAll resize operations will keep the original aspect ratio of the image. There will be no distortion.\n\nKeeping either width or height at zero will auto calculate the value for you.\n\n```php\n# fit the image into a bounding box of 500x500 pixels\nSlika::run('input.jpg')-\u003eresize(500,500)-\u003esave('output.png', 'png');\n\n# adjust the image to a maximum width of 500 pixels \nSlika::run('input.jpg')-\u003eresize(500,0)-\u003esave('output.png', 'png');\n\n# adjust the image to a maximum height of 500 pixels \nSlika::run('input.jpg')-\u003eresize(0,500)-\u003esave('output.png', 'png');\n```\n\n### crop\n\nSimilar to resizing, but this time the image will be cropped to fit the new aspect ratio.\n\n```php\nSlika::run('input.jpg')-\u003ecrop(500,500)-\u003esave('output.png', 'png');\n```\n\n### rotate\n\nRotates the image. The parameter passed is one of the EXIF orientation flags:\n\n![orientation flags](https://i.stack.imgur.com/BFqgu.gif)\n\nFor your convenience there are three Constants defined:\n\n\n* `Slika::ROTATE_CCW` counter clockwise rotation\n* `Slika::ROTATE_CW` clockwise rotation\n* `Slika::ROTATE_TOPDOWN` full 180 degree rotation \n\n```php\nSlika::run('input.jpg')-\u003erotate(Slika::ROTATE_CW)-\u003esave('output.png', 'png');\n```\n\n### autorotate\n\nRotates the image according to the EXIF rotation tag if found.\n\n```php\nSlika::run('input.jpg')-\u003eautorotate()-\u003esave('output.png', 'png');\n```\n\n## Options\n\nOptions can be passed as associatiave array as the second parameter in `Slika::run`.\n\nThe following options are availble currently:\n\n| Option      | Default            | Description                                |\n|-------------|--------------------|--------------------------------------------|\n| `imconvert` | `/usr/bin/convert` | The path to ImageMagick's `convert` binary |\n| `quality`   | `92`               | The quality when writing JPEG images       |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplitbrain%2Fslika","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplitbrain%2Fslika","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplitbrain%2Fslika/lists"}