I suggest you do this:
Bring in your data as an array. That ism have your form elements named like:
$check[0], $check[1], etc.
say something like
$chk = serialize($check);
and store $chk in a single array.
Then when you read the array back, have ANOTHER array that contains the filenames, like:
$img = array ("img1.gif","img2.gif", etc.);
and do a
while(list($key,$val) = each($chk)) {
echo "<IMG SRC='$img[$key]'>\n";
}