From http://wpmu.org/daily-tip-how-to-automatically-set-the-featured-image-in-wordpress/