When trying edit media/* templates (ACP -> Edit Template) 4images might return unpredictable results, such as error messages or template being saved in template directory instead of media/
In admin/templates.php find:
$template_file_name = basename($template_file_name);
Replace with:
$template_file_name = (strpos($template_file_name, 'media/') !== false ? 'media/' : '') . basename($template_file_name);