Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not able to see the preview for cropper js

I have created an application using cropper.js for cropping an images, the application is working and the image is cropping but I am not able to see the preview, my preview div is not populating anything correctly while cropping. My code is as given below

Can anyone please tell me some solution for this

Plunker

script

 var $image = $('.img-container > img'),
    $dataRotate = $('#dataRotate'),
    options = {
       modal: true,
       guides: true,
       autoCrop: false,
       dragCrop: true,
       movable: true,
       resizable: true,
       zoomable: false,
       touchDragZoom: false,
       mouseWheelZoom: false,
       preview: '.preview',
      crop: function (data) {
        $dataRotate.val(Math.round(data.rotate));
      }
    };
like image 970
Alex Man Avatar asked Apr 22 '15 05:04

Alex Man


1 Answers

You need to set the size of the .preview element with css. Also set the overflow to hidden, e.g.

.preview {
  overflow: hidden;
  width: 50px; 
  height: 50px;
}

Also forked your plunk and your updated plunk.

like image 161
ekuusela Avatar answered Oct 01 '22 22:10

ekuusela