【发布时间】:2016-03-08 02:25:10
【问题描述】:
我正在尝试使用 Croppie Library 将图像裁剪为 cicle
我尝试使用它们的函数返回 base64 编码的图像。 它返回一个 base64 代码,但没有图像: 这是我的代码:
<div id="vanilla-demo"></div>
</div>
<img id="myImage" src="">
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="croppie.js"></script>
<script type="text/javascript">
var vanilla = new Croppie(document.getElementById('vanilla-demo'), {
viewport: { width: 200, height: 200 , type:'circle'},
boundary: { width: 400, height: 400 },
showZoom: false
});
vanilla.bind('dac.jpg');
vanilla.result('canvas','original').then(function (src) {
console.log(src);
$('#myImage').attr('src', src);
});
</script>
【问题讨论】:
-
什么不工作?
-
可能是愚蠢的评论,但您包含
croppie.css,因为他们指定正确? -
是的,它包含在
标签: javascript image canvas crop croppie