user34537
user34537

Reputation:

Draw a box on an image, javascript only?

What i want to do is have a user upload his image. When its complete it will display the image on the same page w/o refreshing. Here is the part i need to figure out, how do i have the user select a box in the image? so i can crop it when the user is done? (using ImageMagick).

If possible i would like a border for the user to stretch to edit the width and height. Then click within the rect to move around.

Upvotes: 1

Views: 2671

Answers (1)

thedz
thedz

Reputation: 5572

There's a ton of ways; including several pre-written plugins available through the web.

Are you using any frameworks?

Of the below, I've used Jcrop and Lasso.Crop and they've both worked out well. Haven't tried the others.

Here's a non-exhaustive listing:

Pure Javascript

http://www.dhtmlgoodies.com/index.html?whichScript=image-crop

jQuery

http://deepliquid.com/content/Jcrop.html

MooTools

http://www.nwhite.net/2009/02/25/lassocrop-preview/

Prototype

http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous/

Upvotes: 5

Related Questions