Skip to content

Instantly share code, notes, and snippets.

@iwannabebot
Created October 8, 2019 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwannabebot/58d177d83a7328f56ba80bcf5f1fadd9 to your computer and use it in GitHub Desktop.
Save iwannabebot/58d177d83a7328f56ba80bcf5f1fadd9 to your computer and use it in GitHub Desktop.
GcImaging ThumbnailFunction
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
namespace GrapeCity.Documents.Imaging.FunctionsV2
{
public static class ThumbnailFunction
{
[FunctionName("ThumbnailFunction")]
public static void Run(
[BlobTrigger("images/{name}", Connection = "AzureWebJobsStorage")] byte[] myBlob,
[Blob("thumbs/{name}", Connection = "AzureWebJobsStorage")] out byte[] myOutputBlob,
string name,
ILogger log)
{
log.LogInformation($"ThumbnailFunction function started for \n Name:{name} \n Size: {myBlob.Length} Bytes");
myOutputBlob = GcImagingOperations.GetConvertedImage(myBlob);
log.LogInformation($"ThumbnailFunction function finished");
}
public static void CopyStream(Stream input, Stream output)
{
byte[] buffer = new byte[32768];
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, read);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment