Skip to content

Commit a3fa354

Browse files
committed
File/image processing: don't read buffer, get byte array
1 parent 5bd2866 commit a3fa354

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/Libraries/SmartStore.Services/Media/PictureService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public virtual byte[] ValidatePicture(byte[] pictureBinary, string mimeType, out
207207
using (var result = _imageProcessor.ProcessImage(query))
208208
{
209209
size = new Size(result.Width, result.Height);
210-
var buffer = result.OutputStream.GetBuffer();
210+
var buffer = result.OutputStream.ToArray();
211211
return buffer;
212212
}
213213
}

src/Presentation/SmartStore.Web/Administration/Controllers/RoxyFileManagerController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private void ImageResize(string path, string dest, int maxWidth, int maxHeight,
210210

211211
using (var result = _imageProcessor.Value.ProcessImage(query))
212212
{
213-
buffer = result.OutputStream.GetBuffer();
213+
buffer = result.OutputStream.ToArray();
214214
System.IO.File.WriteAllBytes(dest, buffer);
215215
}
216216
}

src/Presentation/SmartStore.Web/Controllers/MediaController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ private async Task<byte[]> ProcessAndPutToCacheAsync(CachedImageResult cachedIma
351351

352352
using (var result = _imageProcessor.ProcessImage(processQuery))
353353
{
354-
var outBuffer = result.OutputStream.GetBuffer();
354+
var outBuffer = result.OutputStream.ToArray();
355+
355356
await _imageCache.PutAsync(cachedImage, outBuffer);
356357

357358
if (cachedImage.Extension != result.FileExtension)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<%@ Application Codebehind="Global.asax.cs" Inherits="SmartStore.Web.MvcApplication" Language="C#" %>
1+
<%@ Application Codebehind="Global.asax.cs" Inherits="SmartStore.Web.MvcApplication" Language="C#" %>

0 commit comments

Comments
 (0)