【发布时间】:2016-04-04 12:54:52
【问题描述】:
我正在尝试使用 jQuery 插件 cropit 创建个人资料照片上传和裁剪。
这是我的标记:
<form action="#">
<div class="image-editor">
<div class="cropit-image-preview"></div>
<div class="image-size-label"> Resize image </div>
<input type="range" class="cropit-image-zoom-input">
<input type="hidden" name="image-data" class="hidden-image-data" />
<input type="file" class="cropit-image-input">
<button type="submit">Submit</button>
</div>
</form>
我的问题是如何加载和裁剪现有图像,如first demo。
【问题讨论】:
-
...demo不是自带源码吗?为什么它不适合你?
-
不,没有使用现有图像的演示。我尝试检查 thtat 演示页面,发现图像被加载为背景。我尝试将现有图像加载为“.cropit-image-”的背景图像预览”。但裁剪不起作用。
-
它给出了关于如何使用图像的明确说明:
// In the demos I'm passing in an imageState option // so it renders an image by default: // $('#image-cropper').cropit({ imageState: { src: { imageSrc } } }); -
@Juhana Oopz,我的错。我多次阅读文档但没有看到它。无论如何,谢谢