friendica/view/templates/cropbody.tpl

55 lines
1.6 KiB
Smarty
Raw Normal View History

2013-04-23 11:47:57 +00:00
<h1>{{$title}}</h1>
<p id="cropimage-desc">
2018-03-29 15:57:06 +00:00
{{$desc}}
2013-04-23 11:47:57 +00:00
</p>
2018-03-29 15:57:06 +00:00
2013-04-23 11:47:57 +00:00
<div id="cropimage-wrapper">
2018-03-29 15:57:06 +00:00
<img src="{{$image_url}}" id="croppa" class="imgCrop" alt="{{$title}}" />
2013-04-23 11:47:57 +00:00
</div>
2018-03-29 15:57:06 +00:00
2013-04-23 11:47:57 +00:00
<div id="cropimage-preview-wrapper" >
2018-03-29 15:57:06 +00:00
<div id="previewWrap" class="crop-preview"></div>
2013-04-23 11:47:57 +00:00
</div>
<script type="text/javascript" language="javascript">
2018-03-29 16:06:56 +00:00
var image = document.getElementById('croppa');
var cropper = new Cropper(image, {
aspectRatio: 1 / 1,
viewMode: 1,
preview: '#profile-photo-wrapper, .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);
},
ready: function() {
// Add the "crop-preview" class to the preview element ("profile-photo-wrapper").
var cwrapper = document.getElementById("profile-photo-wrapper");
cwrapper.classList.add("crop-preview");
}
});
2013-04-23 11:47:57 +00:00
</script>
<form action="profile_photo/{{$resource}}" id="crop-image-form" method="post" />
2018-03-29 15:57:06 +00:00
<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}}" />
2018-03-29 15:57:06 +00:00
</div>
2013-04-23 11:47:57 +00:00
</form>