设置上JCrop的最小高度和宽度

Com*_*ist 0 javascript jquery image crop jcrop

我正在开发一组电子邮件模板,允许用户添加文本,图像,更改字体和颜色等.现在,如果用户想要在模板的特定区域添加图像,他们将首先点击他们所在的区域想要添加图像,然后在我的应用程序中添加库中的图像.现在让我们考虑一下他们在模板上点击的区域的可接受尺寸是500*500,从库中选择的图像是1000*1000,在这种情况下,应用程序将自动调出一个裁剪工具,使用它可以调整大小图片.但是,我想将裁剪工具限制为仅可拖动到模板中所需位置的最小高度或宽度,即,在此示例中,它们不能再将裁剪工具拖动到高度或宽度以下的任何位置. 500,虽然他们可以保持一个或两个尺寸高于500,因为裁剪工具自动将其调整回500*500(例如800*500,甚至500*1000也是可接受的,因为裁剪工具自动调整图像大小以适应在模板中).我有一个看文档这个问题,但不能真正找到一个合适的回答我的问题.下面是我的一些代码验证如果图像需要进行剪裁:

var SelectedAreaHeight; //returns the height of the area they clicked on the template
var SelectedAreaWidth; //returns the width similarly

function ImageClick(data)
{
var ReturnImageHeight; //returns the height of the area they clicked on
var ReturnImageWidth; //returns the width similarly

    $(".ResizeImage").each(function()
    {
        ReturnImageHeight = $(this).data("height");
        ReturnImageWidth = $(this).data("width");
    }
    });

    if (ReturnImageHeight > SelectedAreaHeight || ReturnImageWidth > SelectedAreaWidth)
    {
        //this checks if the selected image's height OR width is greater
        //than the  desired area in the template to bring up the cropping tool.
    }
}
Run Code Online (Sandbox Code Playgroud)

现在是有办法,我可以只限制的方式,它是不低于"作物能"裁剪工具SelectedAreaHeightOR SelectedAreaWidth?另外请忽略上面示例代码的任何问题,因为我没有粘贴所有代码(它做的不仅仅是这个).

Mr.*_*.TK 7

Ekhm:D jcrop中有这样的选项:)

http://deepliquid.com/content/Jcrop_Manual.html#Setting_Options

minSize:array [w,h]:最小宽度/高度,对于无界维度n/a使用0