youmoula / jcrop

Automatically exported from code.google.com/p/jcrop
0 stars 0 forks source link

API enable function under Chrome - does it works? #62

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a div with an image inside, its id is "crop"
2. Use API function on the image, like the docs say:
   e.g. var cropimage = $.Jcrop("#crop", {onSelect: updateCoord}); 
3. Use API function to enable cropping:
   e.g. cropimage.enable();

What is the expected output? What do you see instead?
I expect the image to be cropping-enabled. It works very well under Firefox 7. 
Under Chrome, instead, the cropped-image simply disappears, there is just a 
little black spot in the upper left corner.

What version of the product are you using? On what operating system?
Latest Jcrop plugin (0.9.9), latest JQuery version (1.6.4), tried under Firefox 
7 and Chrome 15.05 under Ubuntu and latest Chrome version under Windows 7

Original issue reported on code.google.com by ema...@gmail.com on 27 Oct 2011 at 2:08

GoogleCodeExporter commented 8 years ago
I'm seeing something similar in that the first time around cropping works fine 
with Chrome but the second time I see the little black spot in the upper left 
corner. Were you able to figure out a fix for this bug?

If I toss in a .disable() and then .enable() right before setting other options 
I get the little black spot in all browsers...

Original comment by cymen...@gmail.com on 9 Nov 2011 at 4:15

GoogleCodeExporter commented 8 years ago
I determined my bug is due to jQuery, chrome and the load event. The first time 
an image is loaded the load event works properly. The second time the load 
event triggers before the image is displayed in the DOM and 
$('#myImage').height() returns 0 instead of the image height (as it does the 
first time).

My work around is to attempt to crop but if the height is zero, try again every 
50ms until it works (on my dev machine it's working reliably on the second 
attempt). I'm not happy with this at all however I'm not sure what else to do 
at the moment.

Original comment by cymen...@gmail.com on 9 Nov 2011 at 9:40

GoogleCodeExporter commented 8 years ago
Sorry to report my bug here -- I'll create a different case. But as an update 
to my two comments above the Chrome/webkit issue appears to be this:

http://code.google.com/p/chromium/issues/detail?id=7731#c12

If I force the browser to refetch the image each time by putting appending in 
Javascript the current time in timestamp form (like so: url + '?' + new 
Date().getTime()) I am able to verify it's this Chrome/webkit strictness that 
is affecting me. This is one way to verify it -- perhaps not a good actual work 
around though.

Original comment by cymen...@gmail.com on 9 Nov 2011 at 9:58

GoogleCodeExporter commented 8 years ago
I did not find any fix, it's a backoffice page and I simply told the users 
"Sorry but use Firefox!" as I was in a hurry in that period.
I will rethink the entire page in a couple of weeks, I should have rewritten 
everything anyway as using cropping was only a work-around for another problem 
I had.

Any news from the owner of the plugin?

Original comment by ema...@gmail.com on 10 Nov 2011 at 10:36