Badger Rails Plugin
(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.
Tricky Git Submodule 1
I recently spent a good amount of time figuring out why the acts_as_taggable_on plugin did not work for me. I used Git’s submodule to grab the code fom GitHub.
> git submodule add git://github.com/mbleigh/acts-as-taggable-on.git vendor/plugin/acts-as-taggable-onIt seems logical to name my plugin directory with dashes since that’s what the path suggests, right? Wrong! If you do that, it does not work because the plugin expects underscores. This is probably due to the way Rails finds and loads the plugins, I guess. Haven’t had time to really dig deep into that…
Use this instead:
> git submodule add git://github.com/mbleigh/acts-as-taggable-on.git vendor/plugin/acts_as_taggable_onI initially didn’t pay attention to this because before Git, I just used:
> script/plugin install http://svn.intridea.com/svn/public/acts_as_taggable_on/I did not have to explicitly tell where to put the plugin. script/plugin is a Rails thing while Git is not.
Hopefully anyone who gets tripped up by this in the future will find out this post.


