Are you going to be fetching the images (or image data) from a database? If so you just use it as a standard while() loop. Like this:
PHP Code:
$counter = 0; // Starting counter
while($imgstuff = $db->fetch_array($imgquery))
{
eval('$eic_imagebits .= "' . fetch_template('eic_imagebits') . '";');
// ...
if($counter == 4) // That counts as 5 images
{
$eic_imagebits .= '<br />'; // Insert Line Break
$counter = 0; // Reset counter
}
else
{
$counter++; // Increment counter
}
}