I just spent a jolly hour creating a Firefox search plugin for our library catalogue. (Actually for Flock, which I’m now using — and lovin’ — for its integration with services like Flickr and Facebook. But I digress.)
Creating the search plugin was easy in most respects. There was plenty of documentation on the plugin format on Google. Unfortunately, all of it seemed to be out of date for Firefox 2.0. But the easy solution to that is to open the searchplugins folder in Firefox (or Flock) and copy one of the files there. Google seems a good one to use.Then edit the details and — viola — you have a search plugin.
Except: one of the requirements is an image file for the toolbar, and it seems that this image needs to be embedded in the xml file and Base64 encoded. I have an icon — the favicon used in our web site, but needed to convert that to Base64.
Now, there is at least one tool available on the web for converting files to Base64, but if you want to do it yourself, and can run perl, here’s a trivial bit of code that will do the conversion for you:
$ perl -we ‘use MIME::Base64; local $/; open ICO, “<favicon.ico” or die “$!\n”; $x=<ICO>; close ICO; print MIME::Base64::encode($x);’ > icon.txt
Then you can simply replace the Google icon Base64 code with the content of icon.txt, and you’re done. (Actually, you may have to remove all the line breaks.)
Blogged with Flock


