Created
June 3, 2018 12:34
-
-
Save glglak/c158711e837d4989f376798dc0590c0e to your computer and use it in GitHub Desktop.
This file contains 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
public async Task<byte[]> GetImageAsByteArray(string imageFilePath) | |
{ | |
CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(connectionStorage); | |
CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient(); | |
CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference (containerReferrence); | |
CloudBlob cloudBlob = cloudBlobContainer.GetBlobReference(new CloudBlockBlob(new Uri(imageFilePath)).Name); | |
await cloudBlob.FetchAttributesAsync(); | |
long fileByteLength = cloudBlob.Properties.Length; | |
Byte[] myByteArray = new Byte[fileByteLength]; | |
await cloudBlob.DownloadToByteArrayAsync(myByteArray, 0); | |
return myByteArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment