🐛 优化代码
This commit is contained in:
@@ -203,6 +203,9 @@ namespace GeekDesk.Util
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
FileInfo file = new FileInfo(filePath);
|
||||
if (file.Exists && file.Length > 0)
|
||||
{
|
||||
Image img = Image.FromFile(filePath);
|
||||
if (img.Width <= tWidth && img.Height <= tHeight)
|
||||
@@ -247,6 +250,10 @@ namespace GeekDesk.Util
|
||||
File.Delete(tempPath);
|
||||
return bm;
|
||||
}
|
||||
} else
|
||||
{
|
||||
return Base64ToBitmapImage(Constants.DEFAULT_IMG_IMAGE_BASE64);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -364,6 +371,9 @@ namespace GeekDesk.Util
|
||||
public static bool IsImage(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
string ext = Path.GetExtension(path);
|
||||
if (!string.IsNullOrEmpty(ext))
|
||||
{
|
||||
string strExt = Path.GetExtension(path).Substring(1);
|
||||
string suffixs = "bmp,jpg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,WMF,webp,avif";
|
||||
@@ -375,6 +385,7 @@ namespace GeekDesk.Util
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
Reference in New Issue
Block a user