{script} $(function(){ var jcrop_api, boundx, boundy; $('#cropbox').Jcrop({ aspectRatio: 1, onSelect: updateCoords, onChange: showCoords },function(){ var bounds = this.getBounds(); boundx = bounds[0]; boundy = bounds[1]; jcrop_api = this; }); function updatePreview(c){ if (parseInt(c.w) > 0){ var rx = 100 / c.w; var ry = 100 / c.h; $('#preview').css({ width: Math.round(rx * boundx) + 'px', height: Math.round(ry * boundy) + 'px', marginLeft: '-' + Math.round(rx * c.x) + 'px', marginTop: '-' + Math.round(ry * c.y) + 'px' }); } }; function updateCoords(c){ updatePreview(c); $('#x').val(c.x); $('#y').val(c.y); $('#w').val(c.w); $('#h').val(c.h); }; function showCoords(c){ updatePreview(c); $('#x1').val(c.x); $('#y1').val(c.y); $('#x2').val(c.x2); $('#y2').val(c.y2); $('#w').val(c.w); $('#h').val(c.h); }; function checkCoords(){ if (parseInt($('#w').val())) return true; alert(D.L('请先裁剪,然后点击提交!')); return false; }; }); {/script}
头像裁剪
对头进行裁剪

用鼠标选中你需要裁剪的块,然后点击提交。
裁剪后的图像将会被压缩为尺寸为(200*200)像素的头像,然后会以它创建两个(120*120)和(48*48)的头像。
同时,被裁剪的原图也会被上传,系统处理完毕将会为每个用户生产四张头像。

Preview
提交头像