views:

1680

answers:

3

Hello,

has anyone stumbled upon image editor done either in pure JS, or jQuery - that kind like CKEditor has?

I'm looking for piece of code, that adds handles to image, so you can resize it, or even drag image around, as you wish.

Thank you.

Edit: rephrased.

+2  A: 

Yes there are numerous online. Find here. jCrop is exceptional and awesome.

Teja Kantamneni
unfortunately, none of mentioned work that way as in CKEditor, thank you for try though :]
Adam Kiss
+1  A: 

The way editors such as tinyMCE and CKEditor do it is like this

<div contenteditable="true" id="div1">
    <img src="tache17.jpg" />
</div>
<a href="javascript:alert(document.getElementById('div1').innerHTML)">gimme html</a>

It's a browser thing not a JS thing. Of course placing the image in the div and making the div contentEditable is done with JS but the resizing handles you are talking about are generated by the browser.
Note I haven't tested this in anything other than firefox

meouw
the handles itself are not the biggest problem... the problem is how to inplace resize images... maybe i should rephrase my question again?
Adam Kiss
If you try the code above you'll see that the alert lets you know what size the image is currently (if it has been resized). You can use this technique and not need any JS at all
meouw
A: 

Although none of answers answered my question meouw pointed me the right direction (sort of), so he gets up-vote, and I'll give myself the right answer.

Edit: Hint: I'll generate divs (or spans for that matter) that will act as handles - this way, i have complete control over resizing of image.

Adam Kiss