调整主图像大小后,jcrop 演示不再起作用(已更新图片)
我正在尝试复制此 jcrop 演示。一切正常,除了我的原始图片非常大,因此,根据手册,我正在调整它们的大小 在我的页面上是这样的:
jQuery('#cropbox').Jcrop({
onChange: showPreview,
onSelect: showPreview,
bgColor: 'white',
aspectRatio: 1,
boxWidth: 300,
boxHeight: 500
});
现在的问题是第二个预览窗口( id="preview" )不再显示裁剪框上裁剪部分中的内容。这是一个示例:
显然,预览窗口与我在第一张图片中裁剪的区域不匹配。
知道如何在预先调整主图像大小时正确显示预览图像吗?
i am trying to replicate this jcrop demo. Everything works fine except, my original pictures are very large so, as per the manual, i am resizing them on my page like this:
jQuery('#cropbox').Jcrop({
onChange: showPreview,
onSelect: showPreview,
bgColor: 'white',
aspectRatio: 1,
boxWidth: 300,
boxHeight: 500
});
the issue is now the second preview window ( id="preview" ) no longer shows what is in the cropped section on the cropbox. Here is an example:
clearly, the preview window doesn't match the area that i am cropping in the first picture.
any idea how to get the preview image to show correctly when you are resizing the main image upfront ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试 这个 JSFiddle
html:
css:
js:
try this JSFiddle
html:
css:
js:
对于 (rx * 800),800 应该是真实图像的宽度。对于 (ry * 600),600 应该是真实图像的宽度。我已经针对 800x600 图像进行了测试,它可以工作(使用 Tutorial3.html 并修改它)。另外,不要使用缩放图像的宽度和高度,它不起作用。
For (rx * 800), 800 should be the width of your real image. For (ry * 600), 600 should be the width of your real image. I have tested this against an 800x600 image and it works (using Tutorial3.html and modifying it). Also, don't use the width and height of the scaled image, it won't work.