Created
October 8, 2019 13:35
-
-
Save iwannabebot/58d177d83a7328f56ba80bcf5f1fadd9 to your computer and use it in GitHub Desktop.
GcImaging ThumbnailFunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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