Check file path before get absolute path

This commit is contained in:
Jaex 2018-03-22 08:16:01 +03:00
parent 3e6cf489e5
commit 6f29d7ee67

View file

@ -1548,18 +1548,21 @@ public static Image LoadImage(string filePath)
{
try
{
filePath = Helpers.GetAbsolutePath(filePath);
if (!string.IsNullOrEmpty(filePath) && Helpers.IsImageFile(filePath) && File.Exists(filePath))
if (!string.IsNullOrEmpty(filePath))
{
Image img = Image.FromStream(new MemoryStream(File.ReadAllBytes(filePath)));
filePath = Helpers.GetAbsolutePath(filePath);
if (HelpersOptions.RotateImageByExifOrientationData)
if (!string.IsNullOrEmpty(filePath) && Helpers.IsImageFile(filePath) && File.Exists(filePath))
{
RotateImageByExifOrientationData(img);
}
Image img = Image.FromStream(new MemoryStream(File.ReadAllBytes(filePath)));
return img;
if (HelpersOptions.RotateImageByExifOrientationData)
{
RotateImageByExifOrientationData(img);
}
return img;
}
}
}
catch (Exception e)