我正在尝试使用 Jcrop 裁剪图像。它不起作用,我不断收到异常“输入字符串格式不正确”。
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery('#crop').Jcrop({
onSelect: updateCoords
});
});
function updateCoords(c) {
jQuery('#X').val(c.x);
jQuery('#Y').val(c.y);
jQuery('#W').val(c.w);
jQuery('#H').val(c.h);
};
<asp:Button ID="Submit" runat="server" Text="Crop"
onclick="Submit_Click" />
<asp:Image ID="Image" runat="server" Visible="False" />
<img src="Content/UploadedImage/Image.jpg" id="crop" alt=""/>
<asp:HiddenField ID="X" runat="server" />
<asp:HiddenField ID="Y" runat="server" />
<asp:HiddenField ID="W" runat="server" />
<asp:HiddenField ID="H" runat="server" />
试图获取坐标
protected void Submit_Click(object sender, EventArgs e)
{
if (IsPostBack)
{
int x = Convert.ToInt32(X.Value);
int y = Convert.ToInt32(Y.Value);
int w = Convert.ToInt32(W.Value);
int h = Convert.ToInt32(H.Value);