【发布时间】:2023-04-06 02:20:01
【问题描述】:
我在我的 ASP.NET C# 应用程序中使用 JCrop 来裁剪图像。 默认情况下,我希望将裁剪选择区域设置在图像的中心, 这是我当前的代码,但问题是,它总是从 0,0 开始选择。
$('#img_crop').Jcrop({ //img_crop is the ID of image control
onChange: updatePreview, // will display the selected img on change.
onSelect: updatePreview, // will display the selected img Img_preview
bgColor: 'black',
bgOpacity: .6,
//setSelect: [100, 100, 240, 240],
setSelect: [ ($('#img_crop').attr('width') / 2) - 70,
($('#img_crop').attr('height') / 2) - 70,
($('#img_crop').attr('width') / 2) + 70,
($('#img_crop').attr('height') / 2) + 70
],
onSelect: storeCoords, // will tell the coordinates
aspectRatio: 1
}
【问题讨论】:
标签: jquery asp.net image-resizing jcrop