# j-PictureUploadExpert

> j-PictureUploadExpert: advanced usage; drag and drop support

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

- advanced usage
- drag and drop support
- supports `multiple`
- supports EXIF orientation
- multiple images are send one by one
- supports j-Loading

__Configuration__:

- `url {String}` (__IMPORTANT__) upload URL (required)
- `width {Number}` a picture width (required)
- `height {Number}` a picture height (required)
- `background {String}` (optional) a background color (default: white)
- `schema {String}` prepared object for sending (default: `{file:base64,filename:filename}`, `base64` + `filename` is a value from preview)
- `quality {Number}` JPEG quality (default: `90`)
- `customize {Boolean}` resizes picture to the entire defined size (default: `true`)
- `disabled {Boolean}` disables image upload (default: `false`)
- `clickselector {String}` a class for custom click selector (default: `none`)
- `dropselector {String}` a class for custom drop selector (default: `none`)
- `class {String}` toggles class on `dropselector` if the drag over is emitted  (default: `over`)
- `error {String}` a path to method `method(err)` when an error is thrown

Use it with `<ui-component name="pictureuploadexpert">`. 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: Denis Granec. Source: the Componentator components repository, MIT license.

```html example.html
<style>
	.dragdrop-message { margin-top:35px; text-align:center; font-weight:bold; }
	.dragdrop-container { height:100px; background:#EFEFEF; border:2px dashed #CCC; border-radius: 2px; }
	.over { border-color: #000 !important; }
</style>

<ui-component name="loading" class="hidden"></ui-component>

<div style="padding:50px;max-width:300px">
	<ui-component name="pictureuploadexpert" path="pictures" config="width:200;height:200;url:/api/upload/base64/;dropselector:.dragdrop-container" class="link m">Click to upload</ui-component>
	<div class="dragdrop-container m">
		<div class="dragdrop-over">
			<div class="dragdrop-message">Drop images here</div>
		</div>
	</div>
</div>

<script>
	var pictures = [];
</script>
```
