2

Is there any option to restrict the croppable area of the image with jCrop.

I want to leave out a 10px area around the image for border purpose, so when user selects the crop region he should not be able to move beside the allowed croppable region.

enter image description here

For example, Image here is 400x300 px, and I want to restrict the croppable region to 380x280 px.

sven
  • 775
  • 5
  • 14

1 Answers1

0

Recently I faced a similar problem. Trying to solve it, I explored the source code of the Jcrop plugin and found the undocumented option, which makes exactly what is needed.

So in case if you need to restrict the croppable area with 10px from each side, it should look like this:

$(document).ready(function () {
    $('image').Jcrop({
        edge: {w: 10, n: 10, e: -10, s: -10},
        // all another options
    });
});

Note, that this option is available only in 2.0.x version of the plugin.

leodee
  • 1
  • 1