日期:2014-05-16 浏览次数:20450 次
(function(scope){
var ImageCropper = function(width, height, cropWidth, cropHeight)
{
this.width = width;
this.height = height;
this.cropWidth = cropWidth;
this.cropHeight = cropHeight;
this.image = null;
this.imageCanvas = null;
this.imageContext = null;
this.imageScale = 1;
this.imageRotation = 0;
this.canvas = null;
this.context = null;
this.previews = [];
}
scope.ImageCropper = ImageCropper;
ImageCropper.prototype.loadImage = function(file)
{
alert("1");
var reader = new FileReader();
var me = this;
reader.readAsDataURL(file);
reader.onload = function(evt)
{
if(!me.image) me.image = new Image();
me.image.onload = function(e){me._init()};
me.image.src = evt.target.result;
}
} })(window);
var cropper;
function init(){
cropper = new ImageCropper(300, 300, 180, 180);
}
function onPhotoURISuccess(imageURI) {
cropper.loadImage(imageURI);
}