Get the alt text from an image path from it's title with the extension
public static string GetAltTextFromImage(string path)
{
string result = string.Empty;
if (!string.IsNullOrEmpty(path))
{
// Get start position for image name from path
int first = path.LastIndexOf("/") + 1;
// Get last position for image name from path
int last = path.LastIndexOf(".");
result = last > first ? path.Substring(first, last - first) : path;
}
return result;
}