【问题标题】:jcrop - default crop selection at centerjcrop - 中心的默认裁剪选择
【发布时间】: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


【解决方案1】:

可能未设置属性“宽度”和“高度”。我宁愿使用 $('#img_crop').width() 和 $('#img_crop').height() 来查看是否可行。

【讨论】:

  • 解决方案是什么??
猜你喜欢
  • 2014-01-22
  • 1970-01-01
  • 2012-05-01
  • 2013-01-08
  • 2023-03-13
  • 2013-10-29
  • 1970-01-01
  • 1970-01-01
  • 2013-04-01
相关资源
最近更新 更多