We currently have a system for cropping images that uses jCrop on the front-end, and System.Drawing
in .NET on the backend - this works very well, but now we need to introduce image rotation. Only 90 degree angles are needed, and jQuery.Rotate works fine in isolation, but I would like to combine these two jQuery plugins gracefully. Do you have any experience in this area? Are there "shake & bake" solutions?
views:
1244answers:
2
A:
I think jQuery pipe-lining is the answer for any jQuery plugin
for example:
$("image").rotate(foo).crop(foo);
Ahmed Khalaf
2009-09-17 11:15:56
I'm afraid this won't work. Both jCrop and jQuery-Rotate make substantial changes to the DOM; they need to integrate in some way. As a last resort I could split the rotation and cropping over several steps, but I'd rather keep them in together.
Daniel Schierbeck
2009-09-17 11:45:35
Pipelining.. doesn't exist in jQuery. Every function just returns a `jQuery` object.
Dykam
2009-09-17 14:50:55
for Dykam: and this is what we call pipe-lining :D, you can pipeline more than one operationfor Daniel: you are right, but we still can find a solution... i liked this problem and will post another answer if i find one
Ahmed Khalaf
2009-09-17 17:13:14
I believe the correct term is "chaining" not "pipe-lining"
zachleat
2010-02-18 01:32:21
A:
Since the two plugin-ins operate in very different ways, I don't think you can readily combine the two. jCrop simply allows you to define a rectangular marquee over an image. Rotation, on the other hand, either uses <canvas>
to actually rotate the image or the DXImageTransform filter to show it rotated (not actually rotating the source image.)
Ates Goral
2009-09-17 14:37:07
on IE Rotation is done with angle attribute, which means you can do rotation and then jCrop
Ahmed Khalaf
2009-09-17 17:14:20
What angle attribute? The official site of jquery-rotate (http://code.google.com/p/jquery-rotate/) states: Two JavaScript image handling implementations are supported: 1. using DXImageTransform filter for Microsoft Internet Explorer 2. using Canvas object for other browsers
Ates Goral
2009-09-17 17:54:25
yes, and the filter is applied with css, so it's achievable to rotate then jCrop after applying the rotation
Ahmed Khalaf
2009-09-18 17:23:10
I still don't think that will work. Firstly, the filter is only used on IE. What about FF? Also, if the crop plug-in is reading the image's dimensions, they won't change with the CSS filter; CSS only changes the presentation of the image. If you still think this is doable, I think the onus is on you to write a working demo :)
Ates Goral
2009-09-18 18:00:43