adriengibrat / jQuery-crop

Image Cropping jQuery Plugin
24 stars 13 forks source link

multiple image sizes #3

Closed edba1970 closed 11 years ago

edba1970 commented 11 years ago

Is there a way to have multiple images with different sizes? I basically have 2 images on the page. One is 185px x 185px and the other one is 830px x 300px. It appears that when both are loaded, the first image takes the dimensions of the second image. Both images become 830 x 300.

Also, how do I make the plugin work when I load images dynamically? When I load the images dynamically, the zoom in / out no longer work.

Thanks.

adriengibrat commented 11 years ago

Hello, please provide sample code (you may use http://jsfiddle.net/).

It seems you're not using the plugin the right way for what you want to achieve ;)

edba1970 commented 11 years ago

Here's the link http://jsfiddle.net/km38G/

doesn't entirely behave the same way as it is on my machine but the idea is that when I add the second crop script, the first image doesn't move any more. On my local machine, the first image becomes the same size as the second image. One note I would like to make is that I am testing it on Mozilla and this doesn't happen on IE 9.

Also, when I load images dynamically, the controls don't work any more. I cannot zoom in and zoom out. I removed line 35 if ( ! self.width )and removed line 39 if ( self.width ) and changed line 34 from .on( 'load.' + namespace, function ()  to .on( 'load', function () which worked when loading images dynamically but now I cannot drag the image left or right.

All these problems only happen when I attach the second image to the script. Still line 39, 35, and 34 had to be removed for dynamic image load.

Thanks.


From: Adrien Gibrat notifications@github.com To: adriengibrat/jQuery-crop jQuery-crop@noreply.github.com Cc: edba1970 edba1970@yahoo.com Sent: Wednesday, September 11, 2013 12:56 PM Subject: Re: [jQuery-crop] multiple image sizes (#3)

Hello, please provide sample code (you may use http://jsfiddle.net/). It seems you're not using the plugin the right way for what you want to achieve ;) — Reply to this email directly or view it on GitHub.

adriengibrat commented 11 years ago

Thank for reporting this bug. Sorry I suggested you was doing it wrong, it was an actual bug, i was doing it wrong ;) I fixed the pb of size... it was a pb of options shared between different instances via the prototype of the plugin... About the dynamic loading i've made some change to fix that too.

Glad you use this plugin. When I wrote it i finally did not used it in prod, so it wasn't tested enough, sorry about that!

adriengibrat commented 11 years ago

Let me know if it's ok for you ;)

edba1970 commented 11 years ago

it works well as far as loading dynamic images and I can zoom in and out as well, There is a new problem however. When I load a large image and crop it, the x and y are totally in a wrong position. Another words the cropped image is not where I have positioned the image.

adriengibrat commented 11 years ago

Hum, need more info. a test case if possible. Seems ok in the demo: http://adriengibrat.github.io/jQuery-crop/ x & y are top left point.

edba1970 commented 11 years ago

While I was waiting for your initial response, I search all over to see if I could find something similar and found another script which was based on jWindowCrop. That script is actually working. It's a bit bigger is size than yours. I'd rather use yours because it has a smaller foot print. My code is exactly the same as far as x, y, w, and h are concerned and it works. I looked at your sample and it seems it works. I am not sure than why it wouldn't work. Can you try to load an image dynamically and then crop a big image. I think this is what causes the problem. Thanks

adriengibrat commented 11 years ago

I can't reproduce the bug... on the demo i've tried to load another big image, in the console run: $('.crop:first').attr('src','http://s3.amazonaws.com/rapgenius/filepicker%2FvCleswcKTpuRXKptjOPo_kitten.jpg');

No pb with the coordinates.

Again, i need a sample to identify actual bug.

could you give me the url of the other jWindowCrop fork ?

edba1970 commented 11 years ago

I don't know where i found it, I search all over the internet for something that works. Here it is https://github.com/terebentina/jQcrop

edba1970 commented 11 years ago

did you try to load an image and position it to a specific location before the crop?

adriengibrat commented 11 years ago

I just loaded an image, then executed: $('.crop:first').attr('src','http://s3.amazonaws.com/rapgenius/filepicker%2FvCleswcKTpuRXKptjOPo_kitten.jpg'); I did not position it... but it should not induce pb... again, i can't help you without sample code, or more precise exemple (more specific than "totally in a wrong position.").

adriengibrat commented 11 years ago

closing the issue as i can't reproduce the bug and i have no news, feel free to reopen it