# j-Crop

> j-Crop: priblíženie; drag and drop

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: sk
Content-SHA256: 4d05d4008102246e5a9c74ed78819ab442e5e022862422e6b3f80b7919690e7c
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

__Podporuje__:

- priblíženie
- drag and drop
- lokálne súbory
- citlivý
- automaticky otáča obrázok podľa informácií EXIF

__Konfigurácia__:

- Cieľová šírka `width {Number}` je potrebná
- požadovaná výška cieľa `height {Number}`
- `dragdrop {Boolean}` umožňuje drag&drop (predvolené: `true`)
- `background {String}` farba pozadia (predvolená: priehľadná)
- `format {String}` formát pre generátor súboru URL (predvolené: `{0}`)

__Atribúty__
- `path="path-with-url-to-image"` - musí obsahovať URL k obrázku

__Metódy__:

```js
// e.g.
var component = FIND('croper');

// Resize canvas
component.reconfigure('width:500;height:200');

// Get cropped image
// component.output([type], [return_object])
var png = component.output('image/png');
var jpg = component.output('image/jpeg');

// Below method automatically detects the transparency and sets the output
var data = component.output();

// var data = component.output(true);
// data.filename {String}
// data.data {String} base64

// New method for clearing of canvas
component.clear();
```

Použite ho so `<ui-component name="crop">`. Keď komponent ešte nie je načítaný, jComponent ho stiahne pri prvom použití z adresy v `DEF.fallback` (predvolene CDN Componentator). Autor: Peter Širka. Zdroj: úložisko komponentov Componentator, licencia MIT.

```html example.html
<div style="width:500px">
	<ui-component name="crop" path="model.picture" config="width:200;height:200"></ui-component>
</div>

<script>
	var model = {};
	model.picture = 'https://avatars0.githubusercontent.com/u/2414252?v=3&s=460';
</script>
```
