Browse Source

Fallback when resizing failed.

pull/556/head
Sebastian 5 years ago
parent
commit
bb7f28b364
  1. 9
      backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs

9
backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs

@ -21,6 +21,7 @@ using Squidex.Infrastructure.Assets;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Log; using Squidex.Infrastructure.Log;
using Squidex.Web; using Squidex.Web;
using ThirdParty.BouncyCastle.Asn1;
#pragma warning disable 1573 #pragma warning disable 1573
@ -200,10 +201,18 @@ namespace Squidex.Areas.Api.Controllers.Assets
} }
using (Profiler.Trace("ResizeImage")) using (Profiler.Trace("ResizeImage"))
{
try
{ {
await assetThumbnailGenerator.CreateThumbnailAsync(sourceStream, destinationStream, resizeOptions); await assetThumbnailGenerator.CreateThumbnailAsync(sourceStream, destinationStream, resizeOptions);
destinationStream.Position = 0; destinationStream.Position = 0;
} }
catch
{
sourceStream.Position = 0;
await sourceStream.CopyToAsync(destinationStream);
}
}
using (Profiler.Trace("ResizeUpload")) using (Profiler.Trace("ResizeUpload"))
{ {

Loading…
Cancel
Save