internal static async Task CreateThumbnailAsync(StorageRepository repo, string fileName, TextWriter log)
{
using (var memStream = await repo.GetBlob(StorageConfig.PhotosBlobContainerName, fileName))
{
MemoryStream thumbnail = null;
try
{
thumbnail = PhotoEditor.ProcessImage(memStream);
await repo.UploadBlobAsync(thumbnail, StorageConfig.ThumbnailsBlobContainerName, fileName);
}
catch (Exception oops)
{
await log.WriteAsync(oops.Message);
throw oops;
}
finally
{
if (null != thumbnail)
{
thumbnail.Dispose();
}
}
}
}