<commit_before># [Image Cropper](http://fengyuanchen.github.io/cropper)

A jQuery image cropping plugin.


# Getting started

## Quick start

Four quick start options are available:

- [Download the latest release](https://github.com/fengyuanchen/cropper/zipball/master).
- Clone the repository: `git clone https://github.com/fengyuanchen/cropper.git`.
- Install with [NPM](http://npmjs.org): `npm install cropper`.
- Install with [Bower](http://bower.io): `bower install cropper`.


## Installation

Include files:

```html
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<link  href="/path/to/cropper.css" rel="stylesheet">
<script src="/path/to/cropper.js"></script>
```


## Usage

Initialize with `$.fn.cropper` method.

```html
<img class="cropper" src="picture.jpg">
```

```javascript
$(".cropper").cropper({
    aspectRatio: 16/9,
    modal: false,
    preview: ".extra-preview",
    done: function(data) {
        console.log(data);
    }
});
```


## Configure

### Setup

Setup with `$("#target").cropper(options)`, or global setup with `$.fn.cropper.setDefaults(options)`.

### Options

#### aspectRatio

- type: string or number
- default: "auto"

The aspect ratio of the cropping zone. e.g., "2", "1.3", "0.5", etc..
Just set it with "auto" to free ratio.

#### done

- type: function
- default:

```javascript
function(data) {}
```

The function will be passed a object data and run when the cropping zone was moving.

#### modal

- type: boolean
- default: true

Show (true) or hide (false) the black modal layer.

#### preview

- type: string
- default: ""

A jquery selector string, add extra elements to show preview.


## Methods

#### enable

- Enable the cropper.
- use with `$("#target").cropper("enable")`.

#### disable

- Disable the cropper.
- use with `$("#target").cropper("disable")`.

#### getImgInfo

- Get the image information, contains: "naturalWidth", "naturalHeight", "width", "height", "ratio".
- The "ratio" is a value of "width / naturalWidth".
- Use with `$("#target").cropper("getImgInfo")`.

#### setAspectRatio

- Enable to reset the aspect ratio after initialization.
- Use with `$("#target").cropper("setAspectRatio", 1.618)`.


## Browser Support

- IE 8+
- Chrome 33+
- Firefox 27+
- Safari 5.1+
- Opera 19+

As a jQuery plugin, you can reference the [jQuery Browser Support](http://jquery.com/browser-support/).


## [License](https://github.com/fengyuanchen/cropper/blob/master/LICENSE)

Released under the [MIT](http://opensource.org/licenses/mit-license.html) license.<commit_msg>Revert "Add a number param"<commit_after># [Image Cropper](http://fengyuanchen.github.io/cropper)

A jQuery image cropping plugin.


# Getting started

## Quick start

Four quick start options are available:

- [Download the latest release](https://github.com/fengyuanchen/cropper/zipball/master).
- Clone the repository: `git clone https://github.com/fengyuanchen/cropper.git`.
- Install with [NPM](http://npmjs.org): `npm install cropper`.
- Install with [Bower](http://bower.io): `bower install cropper`.


## Installation

Include files:

```html
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<link  href="/path/to/cropper.css" rel="stylesheet">
<script src="/path/to/cropper.js"></script>
```


## Usage

Initialize with `$.fn.cropper` method.

```html
<img class="cropper" src="picture.jpg">
```

```javascript
$(".cropper").cropper({
    aspectRatio: 16/9,
    modal: false,
    preview: ".extra-preview",
    done: function(data) {
        console.log(data);
    }
});
```


## Configure

### Setup

Setup with `$("#target").cropper(options)`, or global setup with `$.fn.cropper.setDefaults(options)`.

### Options

#### aspectRatio

- type: string or number
- default: "auto"

The aspect ratio of the cropping zone. e.g., "2", "1.3", "0.5", etc..
Just set it with "auto" to free ratio.

#### done

- type: function
- default:

```javascript
function(data) {}
```

The function will be passed a object data and run when the cropping zone was moving.

#### modal

- type: boolean
- default: true

Show (true) or hide (false) the black modal layer.

#### preview

- type: string
- default: ""

A jquery selector string, add extra elements to show preview.


## Methods

#### enable

- Enable the cropper.
- use with `$("#target").cropper("enable")`.

#### disable

- Disable the cropper.
- use with `$("#target").cropper("disable")`.

#### getImgInfo

- Get the image information, contains: "naturalWidth", "naturalHeight", "width", "height", "ratio".
- The "ratio" is a value of "width / naturalWidth".
- Use with `$("#target").cropper("getImgInfo")`.

#### setAspectRatio

- Enable to reset the aspect ratio after initialization.
- Use with `$("#target").cropper("setAspectRatio")`.


## Browser Support

- IE 8+
- Chrome 33+
- Firefox 27+
- Safari 5.1+
- Opera 19+

As a jQuery plugin, you can reference the [jQuery Browser Support](http://jquery.com/browser-support/).


## [License](https://github.com/fengyuanchen/cropper/blob/master/LICENSE)

Released under the [MIT](http://opensource.org/licenses/mit-license.html) license.
{'fraction_non_alphanumeric': 0.17666601524330663, 'fraction_numerical': 0.0074262263044752785, 'mean_word_length': 3.9834469328140214, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '389797', 'n_tokens_mistral': 1745, 'n_tokens_neox': 1639, 'n_words': 484}