theme_menu_tree
would be the way to resolve this on the template.php
itself. The meat of your function would be identical to your function above. Documentation is at http://api.drupal.org/api/function/theme%5Fmenu%5Ftree
But, I would recommend using CSS for what you're doing. If the text is removed entirely (via php) then you'll be depending on the user's browser to display the images and CSS properly and make navigation possible.
You might consider including both the image and the text, but making the text portion display: none
so that it degrades more gracefully if CSS isn't loaded properly.
anschauung
2009-09-04 11:58:55