Hello,
I just have an idea, but don't know if it will fit your needs, let's say that you display both, I mean Image and text (for main and sub category).
Then, you use some css command to prevent display where this isn't required.
Have a look on
this tutorial
to see how to add css command.
For better understand the way css command have to work, it have to be something close to this idea :
.item_menu_id .main_categroy_class .text_class {
display: none;
}
.item_menu_id .main_categroy_class .sub_category_class .image_class {
display: none;
}
I think that may do the trick and hope this help you to get what you need, even if it's a little "hack" way to proceed.
Regards