Skip to content

Instantly share code, notes, and snippets.

@lilith
Last active December 16, 2015 05:29
Show Gist options
  • Save lilith/5385120 to your computer and use it in GitHub Desktop.
Save lilith/5385120 to your computer and use it in GitHub Desktop.
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
// Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob = container.GetBlockBlobReference("newfile.jpg");
var ms = new MemoryStream();
ImageBuilder.Current.Build("~/originalFile.jpg", ms, new ResizeSettings("width=3200&height=3200&format=jpg"));
ms.Seek(0,SeekOrigin.Begin);
blockBlob.UploadFromStream(ms);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment