var TurnPhoto = function(img){
this.img = img;
this.turn = 0;
};
TurnPhoto.prototype.turnRight90 = function( target, width, height ){
var cvs = document.createElement('canvas');
this.ctx = cvs.getContext('2d');
this.width = '';
this.height = '';
var angle = 0.5 * Math.PI;
cvs.width = height;
cvs.height = width;
this.ctx.rotate( angle );
this.ctx.drawImage(this.img, 0, - height);
target.src = cvs.toDataURL('image/jpg');
};
一个简单的图片旋转方法, 唯一需要注意的就是this.ctx = cvs.getContext('2d') 需要稍微理解下