In the code from step 3 replace
$sql = "SELECT image_id, image_media_file, image_thumb_file, cat_id
With this:
$sql = "SELECT image_id, image_media_file, image_thumb_file, cat_id, image_name
Then find:
$site_template->register_vars("cat_image", $cat_image);
With this:
$site_template->register_vars(array(
"cat_image" => $cat_image,
"cat_image_name" => format_text(@$image_row['image_name'], 2),
));
After that in category_bit.html template use this:
{if cat_image}<img src="{cat_image}" alt="{cat_image_name}">{endif cat_image}