cropper.js时常有更新,为20170902下载;
在croper.js 原版的example->crop-avatar基础上修改;
自适应、截图为canvas并转成base64;
cavas:
var width = e.width;
var height = e.height;
var $canvas = _this.$previewCanvas;
var canvas = $canvas[0];
canvas.width = width;
canvas.height = height;
var cxt=canvas.getContext('2d');
cxt.drawImage(
this,
e.x, e.y, width, height,
0, 0, width, height
);
base64: