scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
874 stars 304 forks source link

How to set the Image backgroundborderwidth on foursides #157

Closed divyamovva closed 8 years ago

scottcheng commented 8 years ago

imageBackgroundBorderWidth: [top, right, bottom, left]. See http://scottcheng.github.io/cropit/#docs-options-imageBackgroundBorderWidth.

divyamovva commented 8 years ago

Thanks for your answer.But here any of two sides[top-bottom left-right] only it is applying

scottcheng commented 8 years ago

Not sure I understand what you are saying. Can you elaborate?

divyamovva commented 8 years ago

i applied image bakgroundborderwidth but it is applying only on two sides not on all the sides

scottcheng commented 8 years ago

Can you show me your code snippet?

divyamovva commented 8 years ago
var newimageData = $('.image-editor').cropit('imageSrc');
        $(".cropit-image-zoom-input").removeAttr('disabled');
        this.options.valuedata = newimageData;
        if (newimageData) {
          $('.image-cropping').cropit({
            imageState: {
              src: newimageData,
            },

            allowDragNDrop: false,
            imageBackground: true,
            imageBackgroundBorderWidth: [100,50,30,20]
            smallImage: 'stretch'
          });
        }
divyamovva commented 8 years ago

When we upload the same image which we upload previous file change event is not calling?how to solve this

scottcheng commented 8 years ago

I don't see any problem in your code, except you missed a , after imageBackgroundBorderWidth: [100,50,30,20]. The border width issue is likely elsewhere.

To you second question, that's right. You can trigger a change event on the file input manually.

divyamovva commented 8 years ago

when click on select image then after selecting a particular image and when we click on cancel file change event is calling how can we prevent this i wrote a popup in change event with empty src it is loading

scottcheng commented 8 years ago

I don't understand what you are trying to do. What exactly are you trying to "prevent" and why do you not want the change event to fire?

divyamovva commented 8 years ago

The thing which i required is on selecting an image i have to open a modal with that image so i opened that modal in the change event

scottcheng commented 8 years ago

OK. If you want to open a model when an image is selected and not when it's deselected from file input, you can simply check whether a file is selected or not before opening the modal -- check the value of the file input.

divyamovva commented 8 years ago

Thank you.It worked for me.