{"id":20638577,"url":"https://github.com/fengyuanchen/jquery-cropper","last_synced_at":"2025-05-15T16:02:34.557Z","repository":{"id":41002007,"uuid":"123292325","full_name":"fengyuanchen/jquery-cropper","owner":"fengyuanchen","description":"A jQuery plugin wrapper for Cropper.js.","archived":false,"fork":false,"pushed_at":"2020-07-21T11:08:22.000Z","size":658,"stargazers_count":681,"open_issues_count":1,"forks_count":257,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-04-14T23:03:55.396Z","etag":null,"topics":["cropper","cropperjs","image-cropper","image-processing","jquery","jquery-plugin"],"latest_commit_sha":null,"homepage":"https://fengyuanchen.github.io/jquery-cropper","language":"JavaScript","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/fengyuanchen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-28T13:57:46.000Z","updated_at":"2024-03-31T11:20:14.000Z","dependencies_parsed_at":"2022-07-14T06:40:31.868Z","dependency_job_id":null,"html_url":"https://github.com/fengyuanchen/jquery-cropper","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengyuanchen%2Fjquery-cropper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengyuanchen%2Fjquery-cropper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengyuanchen%2Fjquery-cropper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengyuanchen%2Fjquery-cropper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fengyuanchen","download_url":"https://codeload.github.com/fengyuanchen/jquery-cropper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247737770,"owners_count":20987718,"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":["cropper","cropperjs","image-cropper","image-processing","jquery","jquery-plugin"],"created_at":"2024-11-16T15:18:33.324Z","updated_at":"2025-04-07T22:03:43.320Z","avatar_url":"https://github.com/fengyuanchen.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# jquery-cropper\n\n[![Build Status](https://img.shields.io/travis/fengyuanchen/jquery-cropper.svg)](https://travis-ci.org/fengyuanchen/jquery-cropper) [![Coverage Status](https://img.shields.io/codecov/c/github/fengyuanchen/jquery-cropper.svg)](https://codecov.io/gh/fengyuanchen/jquery-cropper) [![Downloads](https://img.shields.io/npm/dm/jquery-cropper.svg)](https://www.npmjs.com/package/jquery-cropper) [![Version](https://img.shields.io/npm/v/jquery-cropper.svg)](https://www.npmjs.com/package/jquery-cropper)\n\n\u003e A jQuery plugin wrapper for [Cropper.js](https://github.com/fengyuanchen/cropperjs).\n\n- [Demo](https://fengyuanchen.github.io/jquery-cropper)\n\n## Main\n\n```text\ndist/\n├── jquery-cropper.js        (UMD)\n├── jquery-cropper.min.js    (UMD, compressed)\n├── jquery-cropper.common.js (CommonJS, default)\n└── jquery-cropper.esm.js    (ES Module)\n```\n\n## Getting started\n\n### Installation\n\n```shell\nnpm install jquery-cropper jquery cropperjs\n```\n\nInclude files:\n\n```html\n\u003cscript src=\"/path/to/jquery.js\"\u003e\u003c/script\u003e\u003c!-- jQuery is required --\u003e\n\u003cscript src=\"/path/to/cropper.js\"\u003e\u003c/script\u003e\u003c!-- Cropper.js is required --\u003e\n\u003clink  href=\"/path/to/cropper.css\" rel=\"stylesheet\"\u003e\n\u003cscript src=\"/path/to/jquery-cropper.js\"\u003e\u003c/script\u003e\n```\n\n### Usage\n\nInitialize with `$.fn.cropper` method.\n\n```html\n\u003c!-- Wrap the image or canvas element with a block element (container) --\u003e\n\u003cdiv\u003e\n  \u003cimg id=\"image\" src=\"picture.jpg\"\u003e\n\u003c/div\u003e\n```\n\n```css\n/* Limit image width to avoid overflow the container */\nimg {\n  max-width: 100%; /* This rule is very important, please do not ignore this! */\n}\n```\n\n```js\nvar $image = $('#image');\n\n$image.cropper({\n  aspectRatio: 16 / 9,\n  crop: function(event) {\n    console.log(event.detail.x);\n    console.log(event.detail.y);\n    console.log(event.detail.width);\n    console.log(event.detail.height);\n    console.log(event.detail.rotate);\n    console.log(event.detail.scaleX);\n    console.log(event.detail.scaleY);\n  }\n});\n\n// Get the Cropper.js instance after initialized\nvar cropper = $image.data('cropper');\n```\n\n## Options\n\nSee the available [options](https://github.com/fengyuanchen/cropperjs#options) of Cropper.js.\n\n```js\n$().cropper(options);\n```\n\n## Methods\n\nSee the available [methods](https://github.com/fengyuanchen/cropperjs#methods) of Cropper.js.\n\n```js\n$().cropper('method', argument1, , argument2, ..., argumentN);\n```\n\n## Events\n\nSee the available [events](https://github.com/fengyuanchen/cropperjs#events) of Cropper.js.\n\n```js\n$().on('event', handler);\n```\n\n## No conflict\n\nIf you have to use other plugin with the same namespace, just call the `$.fn.cropper.noConflict` method to revert to it.\n\n```html\n\u003cscript src=\"other-plugin.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"jquery-cropper.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  $.fn.cropper.noConflict();\n  // Code that uses other plugin's \"$().cropper\" can follow here.\n\u003c/script\u003e\n```\n\n## Browser support\n\nIt is the same as the [browser support of Cropper.js](https://github.com/fengyuanchen/cropperjs#browser-support). As a jQuery plugin, you also need to see the [jQuery Browser Support](https://jquery.com/browser-support/).\n\n## Contributing\n\nPlease read through our [contributing guidelines](CONTRIBUTING.md).\n\n## Versioning\n\nMaintained under the [Semantic Versioning guidelines](https://semver.org/).\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT) © [Chen Fengyuan](https://chenfengyuan.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengyuanchen%2Fjquery-cropper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffengyuanchen%2Fjquery-cropper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengyuanchen%2Fjquery-cropper/lists"}