diff options
Diffstat (limited to 'view/tpl/cropcover.tpl')
-rwxr-xr-x | view/tpl/cropcover.tpl | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/view/tpl/cropcover.tpl b/view/tpl/cropcover.tpl index 04b96a603..ba91a2cce 100755 --- a/view/tpl/cropcover.tpl +++ b/view/tpl/cropcover.tpl @@ -6,36 +6,25 @@ <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="width: 320px; height: 116px; max-width: 320px; max-height: 116px; 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; +var image = document.getElementById('croppa'); +var cropper = new Cropper(image, { + aspectRatio: 2.75 / 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); } - - Event.observe( window, 'load', function() { - new Cropper.ImgWithPreview( - 'croppa', - { - previewWrap: 'previewWrap', - minWidth: 240, - minHeight: 87, - maxWidth: 320, - maxHeight: 116, - ratioDim: { x: 100, y:36 }, - displayOnInit: true, - onEndCrop: onEndCrop - } - ); - } - ); +}); </script> |