Display images instead of nodes titles in Drupal 7
For non-coders: the views slideshow module (or something similar) could easily solve this problem without requiring custom code to maintain.
From http://drupal.org/project/views_slideshow:

Views Slideshow can be used to create a slideshow of any content (not just images) that can appear in a View. Powered by jQuery, it is heavily customizable: you may choose slideshow settings for each View you create.
Potential uses
News item slideshow (such as the title, image and teaser of the last 5 news articles submitted)
The Last X number of X submitted (images, videos, blog entries, forum posts, comments, testimonials, etc.).
Rotate any image, based on any filters you can apply in views.
Hottest new products for any ecommerce drupal site.
Rotate contact links, share links, etc.
Heck, you could rotate entire nodes, categories, image galleries, etc. I wouldn't suggest it, but you have that power.
Its also a great space saver. Places where you had multiple images or multiple items such as RSS feeds or category listings can now be presented in a slideshow.
The possibilities are really endless, as the more ways you can think of to categorize and add to views, the more you can rotate.