-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathcrop.html
75 lines (68 loc) · 1.65 KB
/
crop.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<meta charset="UTF-8">
<meta content="width=device-width,initial-scale=1" name="viewport"/>
<script>
UPLOADCARE_PUBLIC_KEY = "demopublickey";
UPLOADCARE_TABS = "default huddle";
UPLOADCARE_DEBUG_UPLOADS = true;
</script>
<script src="./uploadcare.full.js"></script>
<script>
$ = uploadcare.jQuery;
jQuery = uploadcare.jQuery;
</script>
<style>
.long-input {
width: 800px;
}
</style>
<h2>Widget with crop</h2>
<pre><code><input class="long-input" role="uploadcare-uploader" data-crop="<input
id="widget-with-crop-option"
placeholder="4:3, 100x200 upscale, etc"
value="1170x650 minimum"
>"></code></pre>
Try:
<code
><ul>
<li>disabled</li>
<li>4:3</li>
<li>100x200</li>
<li>100x200 upscale</li>
<li>100x100 minimum</li>
<li>or empty string</li>
</ul></code
>
Result:
<div id="widget-with-crop-wrap">
<input
class="long-input"
role="uploadcare-uploader"
placeholder="here will be result CDN url"
data-crop="1170x650 minimum"
value=""
/>
</div>
<script>
UPLOADCARE_LIVE = false;
$("#widget-with-crop-option").on("change", function() {
// uploadcare.jQuery need for ie8:
// it clones nodes with jquery's expando.
var wraper = uploadcare.jQuery("#widget-with-crop-wrap");
var input = wraper
.find('[role="uploadcare-uploader"]')
.attr("data-crop", this.value);
wraper.empty().append(input.clone());
uploadcare.initialize(wraper);
});
</script>
<p>
Shrink before upload:
<input
class="long-input"
role="uploadcare-uploader"
placeholder="here will be result CDN url"
data-image-shrink="800x680"
data-preview-step=""
value=""
/>
</p>