Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fengyuanchen/cropper
⚠️ [Deprecated] No longer maintained, please use https://github.com/fengyuanchen/jquery-cropper
https://github.com/fengyuanchen/cropper
cropper image-cropper image-processing jquery jquery-plugin
Last synced: 3 months ago
JSON representation
⚠️ [Deprecated] No longer maintained, please use https://github.com/fengyuanchen/jquery-cropper
- Host: GitHub
- URL: https://github.com/fengyuanchen/cropper
- Owner: fengyuanchen
- License: mit
- Archived: true
- Created: 2014-02-19T07:48:10.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2020-07-21T10:46:15.000Z (over 4 years ago)
- Last Synced: 2024-04-14T09:45:20.456Z (9 months ago)
- Topics: cropper, image-cropper, image-processing, jquery, jquery-plugin
- Language: JavaScript
- Homepage:
- Size: 5.83 MB
- Stars: 7,757
- Watchers: 336
- Forks: 1,750
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-jquery - cropper - A simple jQuery image cropping plugin. (Images / Data Table)
- awesome-github-star - cropper - cropper | fengyuanchen | 7768 | (JavaScript)
- awesome-javascript - cropper - A simple jQuery image cropping plugin. - ★ 7189 (Image Processing)
- starred-awesome - cropper - A simple jQuery image cropping plugin. (JavaScript)
README
# Cropper
[![Build Status](https://img.shields.io/travis/fengyuanchen/cropper.svg)](https://travis-ci.org/fengyuanchen/cropper) [![Downloads](https://img.shields.io/npm/dm/cropper.svg)](https://www.npmjs.com/package/cropper) [![Version](https://img.shields.io/npm/v/cropper.svg)](https://www.npmjs.com/package/cropper) [![Dependencies](https://img.shields.io/david/fengyuanchen/cropper.svg)](https://www.npmjs.com/package/cropper)
> A simple jQuery image cropping plugin. As of v4.0.0, the core code of Cropper is replaced with [Cropper.js](https://github.com/fengyuanchen/cropperjs).
- [Demo](https://fengyuanchen.github.io/cropper)
- [Cropper.js](https://github.com/fengyuanchen/cropperjs) - JavaScript image cropper (**recommended**)
- [jquery-cropper](https://github.com/fengyuanchen/jquery-cropper) - A jQuery plugin wrapper for Cropper.js (**recommended** for jQuery users to use this instead of Cropper)## Main
```text
dist/
├── cropper.css
├── cropper.min.css (compressed)
├── cropper.js (UMD)
├── cropper.min.js (UMD, compressed)
├── cropper.common.js (CommonJS, default)
└── cropper.esm.js (ES Module)
```## Getting started
### Installation
```shell
npm install cropper jquery
```Include files:
```html
```
### Usage
Initialize with `$.fn.cropper` method.
```html
``````css
/* Limit image width to avoid overflow the container */
img {
max-width: 100%; /* This rule is very important, please do not ignore this! */
}
``````js
var $image = $('#image');$image.cropper({
aspectRatio: 16 / 9,
crop: function(event) {
console.log(event.detail.x);
console.log(event.detail.y);
console.log(event.detail.width);
console.log(event.detail.height);
console.log(event.detail.rotate);
console.log(event.detail.scaleX);
console.log(event.detail.scaleY);
}
});// Get the Cropper.js instance after initialized
var cropper = $image.data('cropper');
```## Options
See the available [options](https://github.com/fengyuanchen/cropperjs#options) of Cropper.js.
```js
$('img').cropper(options);
```## Methods
See the available [methods](https://github.com/fengyuanchen/cropperjs#methods) of Cropper.js.
```js
$('img').once('ready', function () {
$(this).cropper('method', argument1, , argument2, ..., argumentN);
});
```## Events
See the available [events](https://github.com/fengyuanchen/cropperjs#events) of Cropper.js.
```js
$('img').on('event', handler);
```## No conflict
If you have to use other plugin with the same namespace, just call the `$.fn.cropper.noConflict` method to revert to it.
```html
$.fn.cropper.noConflict();
// Code that uses other plugin's "$('img').cropper" can follow here.```
## Browser support
It 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/).
## Contributing
Please read through our [contributing guidelines](.github/CONTRIBUTING.md).
## Versioning
Maintained under the [Semantic Versioning guidelines](https://semver.org/).
## License
[MIT](https://opensource.org/licenses/MIT) © [Chen Fengyuan](https://chenfengyuan.com/)