Kropper screenshot

About

Kropper is a free, open-source image cropper for Rails apps by Jonathon Wolfe. It was inspired by the image-cropping UI in Apple's iChat and is best suited for cropping of user profile images or other instances where you want cropped images to have a specific aspect ratio. This demo app manipulates images that are stored with the attachment_fu plugin, but it would be easy to modify it to crop images stored in some other fashion.

Features

What can I do with this little demo app?

Since I think the most common use of this image cropper would be for cropping user profile images, that's exactly what this demo app lets you do—create and delete 'user' objects and upload/crop their associated 'user_image' objects. So while on the outside it just looks like you're uploading and cropping images, behind the scenes, image files are attached to 'user_image' objects (via attachment_fu) and those 'user_image' objects in turn belong to 'user' objects. Knowing that will make the code much more straightforward.

How the cropping works

While I'm distributing Kropper with the full source of this demo app, the actual cropping action happens in only a few files:

Who's using it?

Kropper is brand-new, so if you use it, pleae let me know and I'll mention your site/app here. You can reach me at jon at kolossus dot com.

Questions? Comments? Suggestions?

If you find a bug, have a suggestion about a feature to add, are having trouble integrating or modifying this code to fit your Rails app, don't hesitate to drop me a line. You can reach me at jon at kolossus dot com.

Future Improvements

It'd be nice to replace dom-drag.js with Scriptaculous for dragging functionality. I'll get around to it, but if someone wants to submit the changes, that'd be welcomed. dom-drag.js is currently used only for dragging the image and zoom slider around.

Also, I haven't tested this with attachment_fu's database or Amazon S3 backend storage options -- let me know if you try it with them.

License

This code is released under the MIT License.

Get the Code

Download the source for Kropper v1.0 and this demo app