-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Crop zone exceeds natural image size #34
Comments
Thank you very much! I will fix it soon! |
It's a great tool. :-) Appreciate your work. On Sunday, July 6, 2014, Fengyuan Chen notifications@github.com wrote:
|
Thanks~ It's OK now. |
Nice. I've been testing it and so far no errors. Heh heh. Math.round vs Math.floor. ;-) |
Guess I spoke too soon. :-) There are still some edge cases where the height and y2 can exceed the size of the original image. The issue seems to be with the This might be solved by having a validation sub-routine to make sure the boundaries are within the naturalHeight and naturalWidth. If a dimension (or both) exceed, data will reduce the exceeding crop dimension by the difference and reduce the other proportionally, taking the aspectRatio in account. See console output with various |
Well, I'll check it carefully. Thanks again~ |
It appears as though something since 14c20fe has negatively affected Here's a soundless video demo showing how changing any of the |
@nbibler Thank you. I know, It's the reason of using |
@fengyuanchen , Is the Math.floor or rounding etc. necessary at all? I was looking at the output results of using jcrop for comparison and they're sending pure decimal values as data crop output. I went ahead and removed all rounding / flooring from the the cropper code and it seems to work just fine. Images and full height crops that were giving me errors before on my server seem to have disappeared. Without any number adjusting cropper will output stuff like this...
Which is being happily accepted by the back-end. I don't know if most server-side image processing takes decimal points as input but if this is indicative of the standard - maybe the number adjusting can be removed or at least, an option? |
@orangewarp Fine! I will try to improve this in the next version. |
@orangewarp I have improve this on v0.4.0, and the difference between input and output is less than 2px. |
In certain scenarios, the crop data object is returning coordinates larger than the image itself. See image example:
Thus, when passed to a server we receive an error like this:
{"code":142,"error":"["Crop height should be in the range [1, height - top].","Crop height should be in the range [1, height - top]."]"}
The text was updated successfully, but these errors were encountered: