I am using JCrop in my ASP.NET C# application to crop image. by default, i want crop selection area to be set in center of the image, here is my current code, but problem is, it starts selection with 0,0 always.
$('#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
}
The attributes 'width' and 'height' are probably not set. I would rather use $('#img_crop').width() and $('#img_crop').height() instead, to see if that works.