Really good hack. Thanks for sharing.
I only did a couple of changes, I post them here for your consideration (I TESTED THE 3.5 version it seems)
The preg_replace code, even if non-expensive, is executed each time a post is parsed, and doesn't use the already in place post cache, you can verify it by querying the postparsed table, the <img> code is left there unreplaced.
Instead, I REMOVED the postbit_complete plugin, and replaced it for a
bbcode_parse_complete plugin with the following content:
Code:
if(defined('NCODE_IMAGERESIZER_INIT'))
{
$this->cached['text'] = $text = preg_replace('/<img src="([^"]*)" border="0" alt="" \/>/', '<img src="\\1" border="0" alt="" onload="NcodeImageResizer.createOn(this);" />', $text);
}
With that, the postbit is just parsed once, and subsequent views of the thread/postbit don't call the preg_replace at all. You can check the "postparsed" table and the new <img> info would be there. Since I run a medium-big forum, every bit of optimisation counts
And... I'm contributing a spanish translation