If you want to display a high configurable gallery of thumbnails based on your posts that contains YouTube videos, with just a line of code, you will like to take a look on YouTubeNails, the first It Works On WordPress plugin.
1. Upload youtubenails folder to the /wp-content/plugins/ directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Just place youtubenails_show(); in your templates where you want the gallery to show
You can also pass five other parameters(none of them are required) when calling the plugin e.g.
youtubenails_show(6,3,'videoposts',1,5,4);
where
6 is the number of posts - thumbs 3 is the number of columns you want to display on each line
'videoposts' is the category, if you want to show posts from a specific category for all categories, just put ''
1 is the code for the YouTube thumbnail API
where
0 = big 480 x 360
1 = small 120 x 90 different from 2 & 3
2 = small 120 x 90 different from 1 & 3
3 = small 120 x 90 different from 2 & 1
if you choose no value for the third parameter, the plugin will randomize each time the page is load
check YouTube API for futher info http://code.google.com/intl/en-UK/apis/youtube/2.0/developers_guide_protocol.html
5,4(the two last parameters) is for the result table cellspacing and cellpadding