<commit_before># Ember CLI Image Cropper [![Build Status](https://travis-ci.org/mhretab/ember-cli-image-cropper.svg?branch=master)](https://travis-ci.org/mhretab/ember-cli-image-cropper)

This Ember CLI addon that wraps the jQuery [Cropper](https://github.com/fengyuanchen/cropper) into an ember component.

It requires cropper

## Installation

For ember-cli 1.13.1 and above. use ember-cli-image-cropper version 0.0.7 and beyond. To install it just use

```sh
# install via ember-cli
$ ember install ember-cli-image-cropper

```
For ember-cli 0.2.7 and below use ember-cli-image-cropper version 0.0.6 and install it using:

```sh
# install via ember-cli
$ ember install:addon ember-cli-image-cropper
```

## Usage

The component initialises cropper when the image is loaded. To use it, extend the component and change the default to your preference. Currently no methods are provided by the addon. To do this you have to use the default cropper methods. For more about available methods checkout [Cropper](https://github.com/fengyuanchen/cropper).

An example below show how to extend the component and get the cropped canvas area.

### Example:

```javascript
// app/components/avatar-cropper.js
import imageCropper from 'ember-cli-image-cropper/components/image-cropper';

export default imageCropper.extend({
  //override default options of cropper
  aspectRatio: 1,
  minCropBoxWidth: 100,
  minCropBoxHeight: 100,
  cropperContainer: '.cropper-container > img',
  previewClass: '.img-preview',
  croppedAvatar: null,

  actions: {
    getCroppedAvatar: function() {
      var container = this.$(this.get('cropperContainer'));
      var croppedImage = container.cropper('getCroppedCanvas');
      this.set('croppedAvatar', croppedImage);
    }
  }
});
```
<commit_msg>Call `getCroppedCanvas()` directly on cropper instance<commit_after># Ember CLI Image Cropper [![Build Status](https://travis-ci.org/mhretab/ember-cli-image-cropper.svg?branch=master)](https://travis-ci.org/mhretab/ember-cli-image-cropper)

This Ember CLI addon that wraps the jQuery [Cropper](https://github.com/fengyuanchen/cropper) into an ember component.

It requires cropper

## Installation

For ember-cli 1.13.1 and above. use ember-cli-image-cropper version 0.0.7 and beyond. To install it just use

```sh
# install via ember-cli
$ ember install ember-cli-image-cropper

```
For ember-cli 0.2.7 and below use ember-cli-image-cropper version 0.0.6 and install it using:

```sh
# install via ember-cli
$ ember install:addon ember-cli-image-cropper
```

## Usage

The component initialises cropper when the image is loaded. To use it, extend the component and change the default to your preference. Currently no methods are provided by the addon. To do this you have to use the default cropper methods. For more about available methods checkout [Cropper](https://github.com/fengyuanchen/cropper).

An example below show how to extend the component and get the cropped canvas area.

### Example:

```javascript
// app/components/avatar-cropper.js
import imageCropper from 'ember-cli-image-cropper/components/image-cropper';

export default imageCropper.extend({
  //override default options of cropper
  aspectRatio: 1,
  minCropBoxWidth: 100,
  minCropBoxHeight: 100,
  cropperContainer: '.cropper-container > img',
  previewClass: '.img-preview',
  croppedAvatar: null,

  actions: {
    getCroppedAvatar: function() {
      var croppedImage = this.get('cropper').getCroppedCanvas();
      this.set('croppedAvatar', croppedImage);
    }
  }
});
```

{'fraction_non_alphanumeric': 0.11161473087818696, 'fraction_numerical': 0.0113314447592068, 'mean_word_length': 4.358118361153262, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '431132', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1103, 'n_words': 342}