ForgeComponents
en

Components

j-ClipboardImage

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

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?

// 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.

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>