aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/cropbody.tpl
blob: e008167bb68d2dbd4f926a4c1f54fd5bc91deea4 (plain) (blame)
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
<h1>{{$title}}</h1>
<p id="cropimage-desc">
{{$desc}}
</p>
<div id="cropimage-wrapper">
<img src="{{$image_url}}" id="croppa" class="imgCrop" alt="{{$title}}" />
</div>
<div id="cropimage-preview-wrapper" >
<div id="previewWrap" class="crop-preview" style="height: 300px; width: 300px; max-width: 300px; max-height: 300px; overflow: hidden;"></div>
</div>

<script type="text/javascript" language="javascript">


var image = document.getElementById('croppa');
var cropper = new Cropper(image, {
	aspectRatio: 1 / 1,
	viewMode: 1,
	preview: '.crop-preview',
	crop: function(e) {
		$( '#x1' ).val(e.detail.x);
		$( '#y1' ).val(e.detail.y);
		$( '#x2' ).val(e.detail.x + e.detail.width);
		$( '#y2' ).val(e.detail.y + e.detail.height);
		$( '#width' ).val(e.detail.scaleX);
		$( '#height' ).val(e.detail.scaleY);
	}
});

</script>

<form action="profile_photo/{{$resource}}" id="crop-image-form" method="post" />
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>

<input type='hidden' name='profile' value='{{$profile}}'>
<input type="hidden" name="cropfinal" value="1" />
<input type="hidden" name="xstart" id="x1" />
<input type="hidden" name="ystart" id="y1" />
<input type="hidden" name="xfinal" id="x2" />
<input type="hidden" name="yfinal" id="y2" />
<input type="hidden" name="height" id="height" />
<input type="hidden" name="width"  id="width" />

<div id="crop-image-submit-wrapper" >
<input type="submit" name="submit" value="{{$done}}" />
</div>

</form>