Here is a block they posted over at the smf-media site.
2, 'rand()'); this part of the code says to pull 2 random pictures. Change it to suit your needs.
global $sourcedir, $context, $txt, $galurl, $scripturl, $settings;
require_once($sourcedir . '/Subs-MGallery.php');
loadMGal_Settings();
if (loadlanguage('MGallery') == false)
loadLanguage('MGallery', 'english');
$items = getMediaItems(0, 2, 'rand()');
echo '
<center><table border="0">
<tr>';
foreach ($items as $item)
echo '
<td>
<div class="smalltext" style="text-align: center; line-height: 1.4em; border: 1px #000000 solid; padding: 5px;">
<a href="',$galurl,'sa=item;id=',$item['id'],'">',$item['title'],'</a><br />
<a href="',$galurl,'sa=item;id=',$item['id'],'"><img alt="" src="',$galurl,'sa=media;id=',$item['id'],';thumb" alt="" /></a><br />
',$txt['mgallery_views'],': ',$item['views'],'<br />
',$txt['mgallery_posted_by'],': <a href="',$scripturl,'?action=profile;u=',$item['poster_id'],'">',$item['poster_name'],'</a><br />
',$txt['mgallery_in_album'],': <a href="',$galurl,'sa=album;id=',$item['id_album'],'">',$item['album_name'],'</a>
',$item['is_new'] ? '<br /><img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '','
</div>
</td>';
echo '
</tr>
</table></center>';