Browse Source

Merge pull request #10068 from abpframework/berkan/fix-cover-image-problem-on-blogging

fix cover images not showing on blogging module
pull/10084/head
ebicoglu 5 years ago
committed by GitHub
parent
commit
90fbd437ee
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/ImageFormatHelper.cs

11
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/ImageFormatHelper.cs

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
namespace Volo.Blogging.Areas.Blog.Helpers
{
@ -16,8 +17,14 @@ namespace Volo.Blogging.Areas.Blog.Helpers
public static bool IsValidImage(byte[] fileBytes, ICollection<ImageFormat> validFormats)
{
var imageFormat = GetImageRawFormat(fileBytes);
return validFormats.Contains(imageFormat);
// System.Drawing only works on windows => https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image?view=net-5.0#remarks
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var imageFormat = GetImageRawFormat(fileBytes);
return validFormats.Contains(imageFormat);
}
return true;
}
}
}

Loading…
Cancel
Save