{"id":20121437,"url":"https://github.com/reliqarts/laravel-guided-image","last_synced_at":"2025-04-08T03:17:09.424Z","repository":{"id":12282703,"uuid":"71434979","full_name":"reliqarts/laravel-guided-image","owner":"reliqarts","description":"Simplified and ready image manipulation for Laravel through intervention image.","archived":false,"fork":false,"pushed_at":"2025-03-19T11:33:02.000Z","size":478,"stargazers_count":34,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-28T11:51:14.506Z","etag":null,"topics":["hacktoberfest","intervention-image","laravel","laravel-6","laravel-6-package","laravel-7","laravel-7-package","laravel-8","laravel-8-package","routing","trait","upload","view"],"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/reliqarts.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"reliq"}},"created_at":"2016-10-20T07:08:14.000Z","updated_at":"2025-03-19T11:33:06.000Z","dependencies_parsed_at":"2024-03-04T02:43:39.878Z","dependency_job_id":"57b92afe-014b-44e6-be71-587117bc572b","html_url":"https://github.com/reliqarts/laravel-guided-image","commit_stats":{"total_commits":176,"total_committers":5,"mean_commits":35.2,"dds":"0.22159090909090906","last_synced_commit":"945dc07480ea44d1df36842facc8d92bfa12095b"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliqarts%2Flaravel-guided-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliqarts%2Flaravel-guided-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliqarts%2Flaravel-guided-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliqarts%2Flaravel-guided-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reliqarts","download_url":"https://codeload.github.com/reliqarts/laravel-guided-image/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767237,"owners_count":20992548,"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":["hacktoberfest","intervention-image","laravel","laravel-6","laravel-6-package","laravel-7","laravel-7-package","laravel-8","laravel-8-package","routing","trait","upload","view"],"created_at":"2024-11-13T19:29:06.350Z","updated_at":"2025-04-08T03:17:09.404Z","avatar_url":"https://github.com/reliqarts.png","language":"PHP","funding_links":["https://github.com/sponsors/reliq"],"categories":[],"sub_categories":[],"readme":"# Laravel Guided Image\n\nGuided Image is an image utility package for Laravel based on Intervention Image.\n\n[![Built For Laravel](https://img.shields.io/badge/built%20for-laravel-red.svg?style=flat-square)](http://laravel.com)\n[![Build Status (all)](https://img.shields.io/travis/com/reliqarts/laravel-guided-image?style=flat-square)](https://travis-ci.com/reliqarts/laravel-guided-image)\n[![Scrutinizer](https://img.shields.io/scrutinizer/g/reliqarts/laravel-guided-image.svg?style=flat-square)](https://scrutinizer-ci.com/g/reliqarts/laravel-guided-image/)\n[![Codecov](https://img.shields.io/codecov/c/github/reliqarts/laravel-guided-image.svg?style=flat-square)](https://codecov.io/gh/reliqarts/laravel-guided-image)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6ac0ef615e2e97909984/maintainability)](https://codeclimate.com/github/reliqarts/laravel-guided-image/maintainability)\n[![License](https://poser.pugx.org/reliqarts/laravel-guided-image/license?format=flat-square)](https://packagist.org/packages/reliqarts/laravel-guided-image)\n[![Latest Stable Version](https://poser.pugx.org/reliqarts/laravel-guided-image/version?format=flat-square)](https://packagist.org/packages/reliqarts/laravel-guided-image)\n[![Latest Unstable Version](https://poser.pugx.org/reliqarts/laravel-guided-image/v/unstable?format=flat-square)](//packagist.org/packages/reliqarts/laravel-guided-image)\n\n\u0026nbsp;\n\n[![Guided Image for Laravel](https://raw.githubusercontent.com/reliqarts/laravel-guided-image/main/docs/images/logo.png)](#)\n\n## Key Features\n\n- On-the-fly image resizing\n- On-the-fly thumbnail generation\n- Image uploading\n- Smart image reuse; mitigating against double uploads and space resource waste.\n\nGuided Image can be integrated seamlessly with your existing image model.\n\n### Guided Routes\n\nThe package provides routes for generating resized/cropped/dummy images. \n- Routes are configurable you you may set any middleware and prefix you want.\n- Generated images are *cached to disk* to avoid regenerating frequently accessed images and reduce overhead.\n\n### Image file reuse\n\nFor situations where different instances of models use the same image.\n- The package provides a safe removal feature which allows images to be detached and only deleted from disk if not being used elsewhere.\n- An overridable method is used to determine when an image should be considered *safe* to delete. \n\n## Installation \u0026 Usage\n\n### Installation\n\nInstall via composer; in console: \n```\ncomposer require reliqarts/laravel-guided-image\n``` \nor require in *composer.json*:\n```json\n{\n    \"require\": {\n        \"reliqarts/laravel-guided-image\": \"^5.0\"\n    }\n}\n```\nthen run `composer update` in your terminal to pull it in.\n\nFinally, publish package resources and configuration:\n\n```\nphp artisan vendor:publish --provider=\"ReliqArts\\GuidedImage\\ServiceProvider\"\n``` \n\nYou may opt to publish only configuration by using the `guidedimage-config` tag:\n\n```\nphp artisan vendor:publish --provider=\"ReliqArts\\GuidedImage\\ServiceProvider\" --tag=\"guidedimage-config\"\n``` \n\n### Setup\n\nSet the desired environment variables so the package knows your image model, controller(s), etc. \n\nExample environment config:\n```\nGUIDED_IMAGE_MODEL=Image\nGUIDED_IMAGE_CONTROLLER=ImageController\nGUIDED_IMAGE_ROUTE_PREFIX=image\nGUIDED_IMAGE_SKIM_DIR=images\n```\n\nThese variables, and more are explained within the [config](https://github.com/ReliqArts/laravel-guided-image/blob/master/config/config.php) file.\n\nAnd... it's ready! :ok_hand:\n\n### Usage\n\nTo *use* Guided Image you must do just that from your *Image* model. :smirk:\n\nImplement the `ReliqArts\\GuidedImage\\Contract\\GuidedImage` contract and use the `ReliqArts\\GuidedImage\\Concern\\Guided` trait, e.g:\n\n```php\nuse Illuminate\\Database\\Eloquent\\Model;\nuse ReliqArts\\GuidedImage\\Concern\\Guided;\nuse ReliqArts\\GuidedImage\\Contract\\GuidedImage;\n\nclass Image extends Model implements GuidedImage\n{\n    use Guided;\n\n    // ... properties and methods\n}\n```\nSee example [here](https://github.com/ReliQArts/laravel-guided-image/blob/master/docs/examples/Image.php).\n\nImplement the `ReliqArts\\GuidedImage\\Contract\\ImageGuide` contract and use the `ReliqArts\\GuidedImage\\Concern\\Guide` trait from your *ImageController*, e.g:\n\n```php\nuse ReliqArts\\GuidedImage\\Contract\\ImageGuide;\nuse ReliqArts\\GuidedImage\\Concern\\Guide;\n\nclass ImageController extends Controller implements ImageGuide\n{\n    use Guide;\n}\n```\nSee example [here](https://github.com/ReliQArts/laravel-guided-image/blob/master/docs/examples/ImageController.php).\n\n#### Features\n\n##### Safely Remove Image (dissociate \u0026 conditionally delete the image)\n\nAn guided image instance is removed by calling the *remove* method. e.g:\n\n```php\n$oldImage-\u003eremove($force);\n```\n`$force` is optional and is `false` by default.\n\n##### Link Generation\n\nYou may retrieve guided links to resized or cropped images like so:\n\n```php\n// resized image:\n$linkToImage = $image-\u003erouteResized([\n    '550',      // width\n    '_',        // height, 'null' is OK \n    '_',        // keep aspect ratio? true by default, 'null' is OK\n    '_',        // allow upsize? false by default, 'null' is OK\n]);\n\n// thumbnail:\n$linkToImage = $image-\u003erouteThumbnail([\n    'crop',     // method: crop|fit\n    '550',      // width\n    '_',        // height\n]);\n```\n**NB:** In the above example `_` resolves to `null`.\n\nHave a look at the [GuidedImage contract](https://github.com/ReliQArts/laravel-guided-image/blob/master/src/Contract/GuidedImage.php) for more info on model functions.\n\nFor more info on controller functions see the [ImageGuide contract](https://github.com/reliqarts/laravel-guided-image/blob/master/src/Contract/ImageGuide.php).\n\n##### Routes\n\nYour actually routes will depend heavily on your custom configuration. Here is an example of what the routes may look like:\n\n```\n|| GET|HEAD | image/.dum//{width}-{height}/{color?}/{fill?}           | image.dummy           | App\\Http\\Controllers\\ImageController@dummy       | web |\n|| GET|HEAD | image/.res/{image}//{width}-{height}/{aspect?}/{upSize?}| image.resize          | App\\Http\\Controllers\\ImageController@resized     | web |\n|| GET|HEAD | image/.tmb/{image}//m.{method}/{width}-{height}         | image.thumb           | App\\Http\\Controllers\\ImageController@thumb       | web |\n|| GET|HEAD | image/empty-cache                                       | image.empty-cache     | App\\Http\\Controllers\\ImageController@emptyCache  | web |\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freliqarts%2Flaravel-guided-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freliqarts%2Flaravel-guided-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freliqarts%2Flaravel-guided-image/lists"}