0

The goal is to let the user move the image around inside a fixed frame and then crop the image using rails.

So far i have only found http://wayfarerweb.com/jquery/plugins/mapbox/, but i was wondering if there was something that also did the cropping?

Thanks!

montrealmike
  • 11,433
  • 10
  • 64
  • 86

1 Answers1

0

What comes to cropping images with Rails (and Paperclip) in this case, have a look at this Railscast. It uses jCrop which uses a different approach then the one you had in mind, but it should give you an idea on how to do this yourself. My best guess would be to convert your image into a jQuery UI "draggable" with constrained movement and when cropping to read out the offset and send it to the server.

polarblau
  • 17,649
  • 7
  • 63
  • 84
  • unfortunately i really need the image inside a box. The draggable jquery UI could work if i match it with plugins.jquery.com/project/mousewheel to zoom in and out. I'm just surprised this doesn't already exist. Thanks for the post – montrealmike Jan 24 '11 at 19:48
  • Your original post didn't mention zooming? Here's a guy who wanted to achieve the same with jQuery UI: http://stackoverflow.com/questions/1590840/drag-a-zoomed-image-within-a-div-clipping-mask-using-jquery-draggable – polarblau Jan 24 '11 at 20:24
  • 1
    Check this project: http://dynamicdrive.com/dynamicindex4/imagepanner.htm Seems to do everything you want (haven't checked the code quality) and should definitely get you started. Good luck! – polarblau Jan 24 '11 at 20:30