fengyuanchen / cropper

⚠️ [Deprecated] No longer maintained, please use https://github.com/fengyuanchen/jquery-cropper
MIT License
7.75k stars 1.74k forks source link

In cropperjs, background color does not change after cropping the image and I can't crop images round #1084

Closed emeksc closed 4 years ago

emeksc commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

emeksc commented 4 years ago

I use cropperjs to crop pictures.I want the background color of the cropped image to be white. Although I give fillColor as white, it still comes in black. And how can I crop pictures in a round shape?


var cropper = $("#canvas1").cropper({
                    aspectRatio: 1 / 1,
                    strict: false,
                    guides: false,
                    dragCrop: false,
                    resizable: false,
                    mouseWheelZoom: false,
                    touchDragZomm: false,
                    autoCropArea: 0.5,
                    scalable: false,
                    cropBoxMovable: true,
                    cropBoxResizable: false,
                    setDragMode: 'crop',
                    minCanvasWidth: 25,
                    rotatable: true,
                    center: true,
                    modal: true,
                    viewMode: 0,
                    dragMode: 'move',
                    minContainerWidth: 200,
                    minContainerHeight: 100,
                    built: function () {
                        $(this).cropper('getCroppedCanvas').toBlob(function (blob) {
                            fillColor: '#fff'
                        });
                    }
                }
)

 .cropper-crop-box, .cropper-view-box {
            border-radius: 50%;
        }

 .cropper-view-box {
            box-shadow: 0 0 0 1px #39f;
            outline: 0;
        }
fengyuanchen commented 4 years ago

Just check out this example: https://fengyuanchen.github.io/cropperjs/examples/crop-a-round-image.html