裁剪圖像我儘量讓預覽當我裁剪圖像的樣子http://jsfiddle.net/YN7ba/ExtJS的Jcrop - 與預覽
隨着region: 'east'
是預覽有width:130
和height:100
和region: 'center'
是origal圖像
但是,當我裁剪圖像預覽不正確像
這裏是我的代碼
tbar:[{
text:'Crop',
handler:function(){
var me = this;
$("#myavatar").Jcrop({
aspectRatio: 1,
minSize : [130,100],
onSelect:me.getCoords,
onChange:me.getCoords
},function(){
// Use the API to get the real image size
var bounds = this.getBounds();
boundx = bounds[0];
boundy = bounds[1];
});
},
getCoords:function(c){
if (parseInt(c.w) > 0) {
xsize = 130,
ysize = 100;
var rx = xsize/c.w;
var ry = ysize/c.h;
$pimg = $('#preview');
$pimg.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'
});
}
}
}],
如何解決的感謝。
究竟是你想實現什麼目標?如果您在東部地區的作物區域的設置圖像的高度和寬度,你要摧毀的寬高比,因爲圖像本身被限制在作物面積的方形。 – existdissolve
@existdissolve我想設置寬度和高度是必要的,如果我刪除,問題仍然是一樣的嗎? – DeLe