koorgoo / ngCropper

AngularJS wrapper for https://github.com/fengyuanchen/cropper
107 stars 72 forks source link

Able to use existing images and images uploaded via browser #14

Closed Azsael closed 1 year ago

Azsael commented 9 years ago

Gives ability to both be able to upload images and manipulate those, or use images already on the page. I.e. already uploaded images that user wants to adjust crop/reposition/zoom etc.

koorgoo commented 9 years ago

@Azsael could you please squash your commits into one without code reformatting. It is very hard to review code with spaces "fixes".

Azsael commented 9 years ago

Yea I will do, it got auto formatted and i tried to revert it. :S

Azsael commented 9 years ago

Sorry I am not sure about the validity of this change much anymore.

I initially was using the crop function that uses the encode method internally which was then breaking when I was adjusting an already uploaded image.

I had heavily adjusted the crop method to cater for rotate however I encountered that the method had major issues in IE so I ended up stealing the cropper from the built function and using it's cropped method, because it deals with the IE issues and rotation.

i.e. built: function () { cropper = $(this); }

var blob = Cropper.decode(cropper.cropper('getCroppedCanvas', data).toDataURL('image/png'));

I see you added the proxy so I will probably use that now.

imbaky commented 8 years ago

@Azsael can you please explain how to use your code?

Azsael commented 8 years ago

Oh my I forgot about this.

Pretty much, if you pass a image url instead of a uploaded it would initialise the cropper with the existing image.