aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/cropbody.tpl
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-02-05 15:58:28 -0800
committerzotlabs <mike@macgirvin.com>2018-02-05 15:58:28 -0800
commitb41c5f349715abc6ca7db563e3938336bc75974e (patch)
tree31a1ee5a74227c30239bb9d2a10341bbacb8ecec /view/tpl/cropbody.tpl
parent05de59d4ad174cb106c3a5b5890732af51730384 (diff)
parent930e1fdbdc798868760f8a4e03f32fc3f42e8bc9 (diff)
downloadvolse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.tar.gz
volse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.tar.bz2
volse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.zip
Merge branch 'master' into z6
Diffstat (limited to 'view/tpl/cropbody.tpl')
-rwxr-xr-xview/tpl/cropbody.tpl43
1 files changed, 17 insertions, 26 deletions
diff --git a/view/tpl/cropbody.tpl b/view/tpl/cropbody.tpl
index 01d9a24a0..d35546ec6 100755
--- a/view/tpl/cropbody.tpl
+++ b/view/tpl/cropbody.tpl
@@ -6,36 +6,27 @@
<img src="{{$image_url}}" id="croppa" class="imgCrop" alt="{{$title}}" />
</div>
<div id="cropimage-preview-wrapper" >
-<div id="previewWrap" ></div>
+<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">
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- Event.observe( window, 'load', function() {
- new Cropper.ImgWithPreview(
- 'croppa',
- {
- previewWrap: 'previewWrap',
- minWidth: 300,
- minHeight: 300,
- maxWidth: 1024,
- maxHeight: 1024,
- ratioDim: { x: 100, y:100 },
- displayOnInit: true,
- onEndCrop: onEndCrop
- }
- );
- }
- );
+
+var image = document.getElementById('croppa');
+var cropper = new Cropper(image, {
+ aspectRatio: 1 / 1,
+ viewMode: 1,
+ preview: '.crop-preview',
+ crop: function(e) {
+ $( 'x1' ).value = e.detail.x;
+ $( 'y1' ).value = e.detail.y;
+ $( 'x2' ).value = e.detail.x + e.detail.width;
+ $( 'y2' ).value = e.detail.y + e.detail.height;
+ $( 'width' ).value = e.detail.scaleX;
+ $( 'height' ).value = e.detail.scaleY;
+
+ }
+});
</script>