Comments (5)
There is no API for listening to image repositioning at the moment. One way to get around this is to listen to mousemove
event on the preview element (see here).
I'd like to understand more about your use case scenario, i.e. why do you want to get the cropped image every time it is repositioned?
from cropit.
Hi,
I am using it to let users upload their image in a registration form.
when they crop it they will need to center the image to get their desired
part of the image.
I fixed it with mouseup()
$('#imgPreview').mouseup( function () {
var value = valueAccessor();
//var image = $('#image-cropper').cropit('export');
var image = $('#image-cropper').cropit('export', {
type: 'image/jpeg',
quality: .9,
originalSize: false
});
value(image);
});
}
Thanks for the help.
On 12 September 2014 07:19, Scott Cheng [email protected] wrote:
There is no API for listening to image repositioning at the moment. One
way to get around this is to listen to mousemove event on the preview
element (see here
Line 164 in cc54f34
).I'd like to understand more about your use case scenario, i.e. why do you
want to get the cropped image every time it is repositioned?—
Reply to this email directly or view it on GitHub
#9 (comment).
from cropit.
I see. Are you trying to reflect the updated cropped image, e.g. show the cropped image somewhere else, every time it is repositioned? Otherwise if what you need is to pass the cropped image with the form, you only need to call export
before form submission, instead of after each time the image is dragged.
Also, you may want to also listen to mouseleave
, because mouseup
does not get called when user moves the mouse out of the preview box whiling pressing it.
from cropit.
Hey thanks. Will add the mouseleave event as well. I call export on change
of image-cropper and update a knockout binding. The cropper seems to pick
up a change when I change the slider. However, if my last action is
dragging the image, then it does not pick it up and the submitted image is
that of the last zoomed one.
On 12 September 2014 14:08, Scott Cheng [email protected] wrote:
I see. Are you trying to reflect the updated cropped image, e.g. show the
cropped image somewhere else, every time it is repositioned? Otherwise if
what you need is to pass the cropped image with the form, you only need to
call export before form submission, instead of after each time the image
is dragged.Also, you may want to also listen to mouseleave, because mouseup does not
get called when user moves the mouse out of the preview box whiling
pressing it.—
Reply to this email directly or view it on GitHub
#9 (comment).
from cropit.
Glad to know it's working, although it still seems to me that a better solution may be to only call export
right before you actually submit the form.
Regarding why change
is not working, my guess is that when the slider is changed, the slider element fires a change
event when then bubbles up to #image-cropper
which you are then able to capture. However when the image is dragged no change
event is fired anywhere.
from cropit.
Related Issues (20)
- IOS photo width problem after uploads
- Crashes in Chrome if 32-bit OS
- Is there an onDrop event in this bundle?
- Watermark addition after the crop
- Resize the crop box not image
- Demo and Documentation doesnt seem to follow HOT 2
- Closed
- How do I use uploaded image in newly generated cropit previews? HOT 1
- Image size override by global css
- Image size is override by global css HOT 1
- Crop it plugin not accepting few dataUri HOT 1
- CSS Loader stuck during onImageLoading
- Cors
- Not Working With all Images HOT 1
- Broken demo
- Keep Image Position Center After Rotate
- solution
- add flip / flop feature in cropit library
- cropit Cannot read property 'push' of undefined HOT 1
- How I can download original size image
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cropit.