# j-ClipboardImage

> This component automaticaly captures images in Clipboard.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 484e3e0c8f4322826fe035c6fd609550366388ced0b5c94ae4c0e14465b38200
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

This component automaticaly captures images in Clipboard.


__Configuration__:

- `quality {Number}` JPEG quality, (default: `90`)
- `maxwidth {Number}` a maximum width (default: `1024`)
- `maxheight {Number}` a maximum height (default: `768`)
- `exec {String}` a link to execute method if the image is obtained
- `disabled {Boolean}` can disable this component
- `type {String}` output type, supports `png` or `jpg` (default)
- __NEW__ `output {String}` output type `base64` (default) or `file`

__How to capture data?__

```javascript
// Attach event
ON('clipboardimage', function(base64) {
	// We have to send data on the server in Base64 format
	AJAX('POST /upload/', { file: base64 }, function(response) {
	});
});
```

Use it with `<ui-component name="clipboardimage">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<ui-component name="clipboardimage" config="quality:90"></ui-component>
<div>Create a screenshot into the clipboard and press shortcuts CMD+V or CTRL+V into the iFrame (iFrame has to be focused).</div>
<br />
<div id="output"></div>

<script>
	ON('clipboardimage', function(base64) {
		var img = new Image();
		img.src = base64;
		$('#output').empty().append(img);
	});
</script>
```
