I just did a (slightly dirty) hack to get lightbox working. Havent got time to look into building it into a plugin, as Ive never written a plugin before and cant see how I could redefine this function like you can do elsewhere in WP.
Use this at your own risk!!!
In wp-includes/post-template.php, line 390 looks like so:
return "<a href='$url' title='$post_title'>$link_text</a>";
Replace this line with the following:
//mafro lightbox mod
list($url, $w, $h) = wp_get_attachment_image_src($id, "full", $icon);
return "<a href='$url' title='$post_title' rel='lightbox'>$link_text</a>";
This set the correct link for the image in link tag and add the rel=”lightbox” attribute we all know and love.
In order for this hack to work you will also need this plugin to include lightbox:
Lightbox 2