Now that I know what mod you were referring to, I can suggest go different way, by using additional field where it would store file extension.
assuming you've added new database field into 4images_images table, named image_ext (there is a tutorial about additional fields, sorry, don't have time find that topic for you).
then in member.php find:
if (!$uploaderror) {
insert below:
$HTTP_POST_VARS['image_ext'] = get_file_extension($new_name);
this will store file extension (including virtual extensions from media sites mod) at image upload from members upload form.
after this you can modify mysql query for this mod to something like this:
$file_ext_list = $file_ext;
foreach($media_sites as $key => $val)
{
$file_ext_list .= ",'" . $key . "'";
}
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND (image_media_file LIKE '%.$file_ext' OR image_ext IN ($file_ext_list))
ORDER BY $custom_sort DESC
LIMIT $num_new_images";