Badger Rails Plugin

Posted by Raymond Law Mon, 23 Jun 2008 14:00:00 GMT

(I also posted about this plugin in the Intridea blog )

Badger (hosted at GitHub) is a simple Rails plugin that creates badges. A site often allows its users to upload a profile image. A profile image is just that, an image resized to fit in a predefined space to show up in the user’s profile.

With Badger, you can have something prettier – a badge that shows the user-uploaded image on top of another image that identifies the user as a part of the community. We have company badges, security badges, so why not web badges to have your users show off his/her affection for your site?

Badger works by accepting cropping parameters of the overlay image in a hash (x1, y1, width, height), which is used to crop the overlay image. It then resizes the cropped image to the size specified by composite_width and composite_height in badger.yml. Finally, it places the resized image on top of the background image at location specified by composite_x and composite_y in badger.yml. The resulting image is saved back to either the filesystem or Amazon S3, using attachment_fu.

Badger requires the attachment_fu plugin, ImageMagick, and MiniMagick. Also, the JavaScript Image Cropper UI can be used to obtain the cropping parameters from the users.

For example:

+ =

Here I overlay RUBY on top of JAVA to produce I LOVE RUBY.

Trackbacks

Use the following link to trackback from your own site:
http://blog.rayvinly.com/articles/trackback/58

Comments

Leave a response

Comments